Skip to content

feat(listener): add workflow name/repo/path to default job counter labels - #29

Merged
pgreze merged 1 commit into
mercari:mercari-masterfrom
ben181231:feat/default-job-workflow-name-label
Aug 19, 2026
Merged

feat(listener): add workflow name/repo/path to default job counter labels#29
pgreze merged 1 commit into
mercari:mercari-masterfrom
ben181231:feat/default-job-workflow-name-label

Conversation

@ben181231

@ben181231 ben181231 commented Aug 19, 2026

Copy link
Copy Markdown

Note

This PR was drafted with the assistance of an AI agent (Claude Code).

WHAT

Add the workflow-identifying labels to the listener's default metrics config for the two job counters:

  • gha_started_jobs_total
  • gha_completed_jobs_total

Labels added to both defaults:

Also adds TestDefaultMetricsJobCounterLabels to pin the expected default label sets.

WHY

We want to relate GitHub Actions workflows to job load on our runner clusters via the exported metrics. The listener already parses job_workflow_ref (workflow_ref_parser.go) and populates the workflow labels in jobLabels() — but they are not part of the default label set, so today they are only emitted when every runner scale set overrides listenerMetrics explicitly. Since listenerMetrics replaces (rather than merges with) the defaults, that means duplicating the entire default metric set across every scale set's values just to add these labels. Putting them into defaultMetrics removes that maintenance burden and lets scale sets go back to relying on defaults.

Scope/cardinality notes:

RELATED

@ben181231
ben181231 force-pushed the feat/default-job-workflow-name-label branch from 9901363 to 066c7d1 Compare August 19, 2026 03:03
@ben181231 ben181231 changed the title feat(listener): add job_workflow_name to default job counter labels feat(listener): add workflow name/repo/path to default job counter labels Aug 19, 2026
@ben181231
ben181231 changed the base branch from mercari-master to master August 19, 2026 03:03
@ben181231
ben181231 marked this pull request as ready for review August 19, 2026 03:11

@pgreze pgreze left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed both #31 and this PR. The approach — patching the fork's defaultMetrics instead of enumerating listenerMetrics in values files — is the right one, and the code is correct and well-tested. But two of the three new labels don't earn their place:

  • job_workflow_path — redundant, please drop it. GitHub requires workflow files to live directly in .github/workflows/ (no subdirectories), so the path is always .github/workflows/{job_workflow_name}.yml|.yaml. The only information it adds over job_workflow_name is the .yml vs .yaml extension, which is worthless in a dashboard.

  • job_workflow_repo — new information only for reusable workflows (where the host repo differs from the caller's repository label); for every normal workflow it equals repository. (repository, job_workflow_name) already gives a unique series per caller-workflow pair, which covers the load-attribution goal. Keep it only if we actually want to aggregate by reusable-workflow host (e.g. "how much runner time does an org-wide reusable-deploy.yml consume across all callers") — defensible, but if not, drop it too.

  • job_workflow_name — keep. Not derivable from any existing default label; this is the whole point.

Practical consequence: dropping both makes #31 entirely unnecessary — the listener already parses job_workflow_name (upstream actions#4240 is in master), so this PR shrinks to adding labelKeyJobWorkflowName to the two counters' defaultMetrics (~6 lines, no parser changes). If we keep job_workflow_repo, #31 is still needed but should have FilePath stripped.

(Posted by Claude Code, reviewed by pgreze)

@ben181231
ben181231 force-pushed the feat/default-job-workflow-name-label branch from 066c7d1 to 87be091 Compare August 19, 2026 03:47
@ben181231
ben181231 changed the base branch from master to mercari-master August 19, 2026 03:48
@ben181231
ben181231 force-pushed the feat/default-job-workflow-name-label branch 2 times, most recently from b0f1534 to 438dd43 Compare August 19, 2026 04:21
@ben181231
ben181231 force-pushed the feat/default-job-workflow-name-label branch 2 times, most recently from 49b9bf0 to d6cb78a Compare August 19, 2026 05:27
@ben181231
ben181231 requested a review from pgreze August 19, 2026 05:35
@ben181231
ben181231 force-pushed the feat/default-job-workflow-name-label branch from d6cb78a to 9bcdaed Compare August 19, 2026 06:12
…bels

Adds job_workflow_name, job_workflow_repo, and job_workflow_path to the
default label sets of gha_started_jobs_total and gha_completed_jobs_total.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ben181231
ben181231 force-pushed the feat/default-job-workflow-name-label branch from 9bcdaed to 98d3766 Compare August 19, 2026 06:42
@pgreze
pgreze merged commit 8b24f22 into mercari:mercari-master Aug 19, 2026
5 checks passed
@ben181231
ben181231 deleted the feat/default-job-workflow-name-label branch August 19, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants