Add job_workflow_repo and job_workflow_path metric labels - #4606
Open
ben181231 wants to merge 1 commit into
Open
Add job_workflow_repo and job_workflow_path metric labels#4606ben181231 wants to merge 1 commit into
ben181231 wants to merge 1 commit into
Conversation
…bels Parse the hosting repository and workflow file path out of job_workflow_ref so that reusable workflows called from another repository remain distinguishable in job metrics. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ben181231
requested review from
Steve-Glass,
mumoshu,
rentziass and
toast-gear
as code owners
August 19, 2026 02:31
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the listener’s job-related Prometheus metrics by adding two optional, structured labels derived from job_workflow_ref—the hosting workflow repository and the workflow file path—so users can retain important workflow identity details without relying on the higher-cardinality job_workflow_ref.
Changes:
- Extend
WorkflowRefInfoandParseWorkflowRefto extractjob_workflow_repo({owner}/{repo}) andjob_workflow_path(workflow file path within that repo). - Expose the new fields via
jobLabels()so all job-related metrics can include them when configured. - Update unit/integration tests and Helm chart
values.yamlexamples to cover/document the new labels.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/ghalistener/metrics/workflow_ref_parser.go | Parse and expose hosting repo + workflow file path from job_workflow_ref. |
| cmd/ghalistener/metrics/workflow_ref_parser_test.go | Add assertions for parsed repo/path alongside name/target across test cases. |
| cmd/ghalistener/metrics/metrics.go | Add new label keys and include them in job label generation. |
| cmd/ghalistener/metrics/metrics_integration_test.go | Validate emitted label maps include the new workflow repo/path labels. |
| charts/gha-runner-scale-set/values.yaml | Document new labels in listener metrics configuration examples. |
| charts/gha-runner-scale-set-experimental/values.yaml | Document new labels in listener metrics configuration examples (experimental chart). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
(NOTE: This pull request is created by Claude Code via GitHub MCP)
WHAT
Adds two new labels to all job-related listener metrics, parsed from
job_workflow_ref:job_workflow_repo: the{owner}/{repo}hosting the workflow file (e.g.myorg/myrepo)job_workflow_path: the workflow file path within that repository (e.g..github/workflows/ci.yml)Changes:
WorkflowRefInfogainsRepoandFilePathfields, populated byParseWorkflowRefjobLabels()exposes them asjob_workflow_repo/job_workflow_pathvalues.yamldocumentation examples updated for both chartsWHY
#4240 introduced
job_workflow_nameandjob_workflow_targetas lower-cardinality alternatives tojob_workflow_ref, with the intent of eventually deprecatingjob_workflow_ref.However,
job_workflow_namealone drops information that only exists injob_workflow_reftoday:{owner}/{repo}/.github/workflows/{filename}@{ref}— the repository hosting the workflow file can differ from the repository running the job (therepository/organizationlabels describe the caller, not the workflow host). Oncejob_workflow_refis removed, the workflow's host repository would be unrecoverable.ci.ymlin different repositories (or in different paths) would collapse into the samejob_workflow_name="ci"series.job_workflow_repoandjob_workflow_pathpreserve that information in structured, individually selectable labels, so users can opt into exactly the granularity they need vialistenerMetricswithout keeping the full high-cardinalityjob_workflow_ref.RELATED