Record the duration of every Dispatcher operation #25535
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 366 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.353
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #25535"
general
weight: 0.35
HadhemiDD
What does this PR do?
Every Dispatcher operation now goes through one context manager,
MetricsHelper.operation():dispatch_batch,fetch_workflow,refresh_jobs,collect_artifacts,gather_batch_results,publish_report, and three new ones for the steps before any batch is dispatched:resolve_runandresolve_changes(resolution) andbuild_plan(planner). When the operation settles it emits:operations.countandoperations.failed, as before.operation.durationdistribution (seconds), taggeddispatcher.operationanddispatcher.operation.result(successorfailure). Failed operations are included; the result tag separates them. It replacesartifacts.download.duration, which is nowoperation.duration{dispatcher.operation:collect_artifacts}.@dispatcher.operation,@dispatcher.operation.resultand@dispatcher.operation.duration_seconds: INFO on success ("Operation fetch_workflow succeeded in 0.42s"), WARNING for a recovered failure (when an operation has several causes, such as a failed listing and failed downloads, each is an entry in@dispatcher.operation.failureswith its own message and fields), ERROR with the traceback when an exception escapes. A validation failure logs once, with the pydantic detail in the traceback.An escaped exception without a recorded cause logs
Operation <name> failed: <error>. Cancelled operations, and gathering abandoned during shutdown, record nothing.To give the resolution steps a failure to settle on,
resolve_run,changes_for_runandvalidate_checkoutraiseRunResolutionErrorinstead of aborting;dispatch_testsaborts with the same message and exit code outside the operation. The separate "Revision resolution failed" and "Planning failed" error lines are now the operations' failure lines.Motivation
Operation metrics only said whether an operation failed, and only failures were logged with their operation, so the dashboard could not show which operation is slow or link from an operation to its logs. Each call site also paired
record_operationandlog_failed_operationby hand on every exit path (about 20 calls), which was easy to get out of sync.Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged