Measure detailed MR status service duration
What does this MR do and why?
This MR adds performance monitoring to the DetailedMergeStatusService by measuring and logging the execution duration of key operations. This helps identify performance bottlenecks in merge request status checks.
Changes made:
- Added
measure_durationmethod to wrap operations with timing measurements - Instrumented
verify_all_mr_mergeability_checksandcheck_ci_statusoperations - Added feature flag
log_detailed_merge_status_duration_enabledto control logging - Logs include operation name, duration, merge request ID, and project name
References
- Related work item: #585222
Screenshots or screen recordings
Not applicable - this is a backend performance monitoring change with no UI impact.
How to set up and validate locally
- Enable the feature flag in the Rails console:
Feature.enable(:log_detailed_merge_status_duration_enabled)
- Call the list MR endpoint (
http://gdk.test:3000/api/v4/groups/:id/merge_requests/), and tail the logs like sotail -f log/application_json.log | jqyou should see a log message like so
{
"severity": "INFO",
"time": "2026-02-23T23:29:18.830Z",
"correlation_id": "01KJ6DBX627BJXEN6NSYCD5F63",
"meta.caller_id": "GET /api/:version/groups/:id/merge_requests",
"meta.remote_ip": "172.16.123.1",
"meta.feature_category": "code_review_workflow",
"meta.http_router_rule_action": "classify",
"meta.http_router_rule_type": "SESSION_PREFIX",
"meta.root_namespace": "gpt",
"meta.client_id": "ip/172.16.123.1",
"event": "merge_requests_detailed_merge_status_service_executed",
"operation": "check_ci_status",
"duration_s": 0.00015500000154133886,
"merge_request_id": 3657,
"project": "gitlabhq1"
}
Edited by Safwan Ahmed