Add duration logging for MergeRequestResetApprovalsWorker
What does this MR do?
Following the same pattern as the log_refresh_service_duration feature flag, this adds comprehensive duration logging for MergeRequests::ResetApprovalsService to help diagnose performance issues mentioned in issue #548046.
Changes
-
Feature flag: Added
log_merge_request_reset_approvals_durationfeature flag -
Duration measurement: Added
measure_durationmethod for single operations -
Accumulative timing: Added
measure_duration_accumulatemethod for operations in loops to sum total time across multiple merge requests -
Detailed logging: Logs timing breakdown for:
- Finding merge requests
- Processing merge requests (loop)
- Reset approvals operations (accumulated per MR)
- Delete approvals operations (accumulated per MR)
- Code owner approval operations (accumulated per MR)
How it works
When the feature flag is enabled, the service will:
- Measure duration of key operations
- Accumulate timing for operations that happen per merge request in loops
- Log detailed timing information including total duration
- Follow the same logging pattern as the refresh service
This will help identify which specific operations are taking the most time in the MergeRequestResetApprovalsWorker performance issues.
Edited by Marc Shaw