Skip to content

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_duration feature flag
  • Duration measurement: Added measure_duration method for single operations
  • Accumulative timing: Added measure_duration_accumulate method 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:

  1. Measure duration of key operations
  2. Accumulate timing for operations that happen per merge request in loops
  3. Log detailed timing information including total duration
  4. 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

Merge request reports

Loading