Add API call observability plugin for triage jobs

Context

We have no visibility into how many API calls each triage job makes. Discovering the redundant members fetch issue (#1749 (closed)) required manually grepping --debug logs. This plugin gives us that data automatically.

What's in this MR?

A monkey-patch plugin (plugins/api_observability.rb) that hooks into the triage gem's HTTP adapter to count every API request. It prints a summary at the end of each job showing total HTTP requests, resources fetched, rate limit waits, and per-endpoint breakdown.

Gated behind API_OBSERVABILITY env var — only active when the variable is set. This MR enables it only on the hourly frequency schedule (5 jobs, runs every hour) for initial production testing. All other schedules are unaffected.

Rollout plan

  1. This MR: enable on hourly only (5 read-heavy jobs, no writes)
  2. Once confirmed safe: enable on schedules that do writes
  3. Long-term: upstream the feature to the gitlab-triage gem as a --summary flag, remove the monkey-patch

Verification

Tested in CI via a dry-run pipeline triggered from this branch (pipeline). API summaries appear at the end of each job log:

label-community-contributions (heaviest hourly job):

======================================================================
  API Call Summary
======================================================================
  Total HTTP requests:  97
  Resources fetched:    6178
  Rate limit waits:     0
  Elapsed time:         343.9s
----------------------------------------------------------------------
     36x  GET /groups/:id/merge_requests?created_after&state
     31x  GET /groups/:id/members
      7x  GET /projects/:id/labels/Community%20contribution
     ...  (26 individual MR detail lookups)
======================================================================

gitlab-org:label-interlocked-epics (light job):

======================================================================
  API Call Summary
======================================================================
  Total HTTP requests:  3
  Resources fetched:    6
  Rate limit waits:     0
  Elapsed time:         0.8s
----------------------------------------------------------------------
      1x  GET /groups/:id/epics?labels&not%5Blabels%5D&state
      1x  GET /groups/:id/epics?labels&state
      1x  GET /groups/:id/labels/Interlock%20committed
======================================================================

gitlab-org:untriaged-issues (medium job):

======================================================================
  API Call Summary
======================================================================
  Total HTTP requests:  12
  Resources fetched:    1171
  Rate limit waits:     0
  Elapsed time:         14.4s
----------------------------------------------------------------------
     12x  GET /groups/:id/issues?issue_type&not%5Blabels%5D&state&updated_after
======================================================================
Edited by David Dieulivol

Merge request reports

Loading
Loading