feat(metrics): exclude out-of-scope runs from KPIs via (skip-metrics) marker#107
Open
ignaciosantise wants to merge 3 commits into
Open
feat(metrics): exclude out-of-scope runs from KPIs via (skip-metrics) marker#107ignaciosantise wants to merge 3 commits into
ignaciosantise wants to merge 3 commits into
Conversation
Draft PRs run WIP CI that shouldn't count toward pass/flake/p95/bug-catch KPIs. A single hung Android E2E job on a draft PR (62m, cancelled at timeout) recently dominated the rn P95 sample (n=8) and pushed the P95 PR feedback KPI to 62m vs the usual ~30m. Workflows now append a " (Draft)" marker to their run-name when triggered by a draft PR (github.event.pull_request.draft), which surfaces as the run's `display_title`. Filter these out centrally in fetch_runs so every KPI script inherits the exclusion. Filtering happens after the raw page size is counted, so pagination still keys off the real page count — a page that's mostly drafts won't look short and stop paging early. Non-PR runs (schedule/push) have no draft context, so their run-name never carries the marker and they're unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Claude finished @ignaciosantise's task in 2m 0s —— View job Review complete
✅ No issues found The change is correct and well-structured. A few observations worth confirming:
|
This was referenced Jul 1, 2026
Broaden the run-name marker from "(Draft)" to a generic "(skip-metrics)" so workflows can exclude any out-of-scope run, not just draft PRs. The workflow decides what's out of scope (draft PRs + manual/workflow_dispatch runs off the default branch) since branch/draft context is free there; this stays a plain string match with no extra API calls. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the shared metrics helper in metrics/scripts/lib.sh so KPI scripts exclude workflow runs that are explicitly marked as out-of-scope via a (skip-metrics) marker in the run name (surfaced by the API as display_title). This centralizes KPI scoping without requiring additional API calls.
Changes:
- Filter out runs whose
.display_titlecontains(skip-metrics)infetch_runs. - Preserve pagination behavior by computing the raw page size (
count) before applying the filter.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The rn row on the E2E KPI dashboard hit P95 PR feedback of 62m (vs ~30m usual): one hung Android E2E job on a draft PR ran to its 60m timeout and, with only n=8 PR runs in the window, dominated the P95. More broadly, work-in-progress and ad-hoc runs shouldn't count toward KPIs at all:
workflow_dispatch) runs off the default branch — ad-hoc dev testing; the SDK repos have no branch filter, so these land in pass/flake today.How
Workflows stamp a
(skip-metrics)marker into theirrun-namefor runs that are out of scope (draft PR, orworkflow_dispatchoff the default branch). It surfaces on the run asdisplay_title. This PR filters those out centrally infetch_runs, so every KPI script inherits it.The exclusion decision lives in each workflow — where draft/branch context is free — which keeps the metric side a plain string match with no extra API calls.
Correctness notes
Rollout
Requires each workflow to emit the marker. In progress:
(skip-metrics)follow-up pending)Until a repo emits the marker, its behavior is unchanged.
🤖 Generated with Claude Code