Skip to content

Expose gha_available_jobs and gha_acquired_jobs listener metrics#4430

Open
PrateekKumar1709 wants to merge 1 commit intoactions:masterfrom
PrateekKumar1709:feat/expose-available-acquired-jobs-metrics
Open

Expose gha_available_jobs and gha_acquired_jobs listener metrics#4430
PrateekKumar1709 wants to merge 1 commit intoactions:masterfrom
PrateekKumar1709:feat/expose-available-acquired-jobs-metrics

Conversation

@PrateekKumar1709
Copy link
Copy Markdown

@PrateekKumar1709 PrateekKumar1709 commented Apr 1, 2026

Fixes #4429

Summary

The RunnerScaleSetStatistic struct from github.com/actions/scaleset provides 7 fields, but RecordStatistics() only exposes 5 as Prometheus gauges. Two fields - TotalAvailableJobs and TotalAcquiredJobs - are silently dropped.

These metrics were proposed in the metrics ADR as available_jobs and acquired_jobs but never implemented.

Changes

  • Add gha_available_jobs and gha_acquired_jobs gauge metrics to the listener exporter
  • Add integration test (TestRecordStatisticsExposesAllFields) verifying all 7 statistic fields are emitted
  • Update Helm chart values.yaml examples for both gha-runner-scale-set and gha-runner-scale-set-experimental
  • Update Grafana dashboard README with the new metrics

Why

Without these metrics, operators cannot observe job queue depth for their scale sets:

  • Available jobs: jobs with matching runs-on labels waiting to be acquired
  • Acquired jobs: jobs acquired by the scale set but not yet assigned to a runner

Queue depth ≈ gha_available_jobs + gha_acquired_jobs

The RunnerScaleSetStatistic struct from the scaleset package provides
TotalAvailableJobs and TotalAcquiredJobs fields, but these were not
being exposed as Prometheus metrics by the listener. This leaves
operators without visibility into the job queue depth for their
scale sets.

Add two new gauge metrics to the ghalistener metrics exporter:
- gha_available_jobs: jobs with matching runs-on labels waiting to be
  acquired by the scale set
- gha_acquired_jobs: jobs acquired by the scale set but not yet
  assigned to a runner

These metrics complete the exposure of all RunnerScaleSetStatistic
fields and were originally proposed in the metrics ADR
(2023-05-08-exposing-metrics.md) but never implemented.

Made-with: Cursor
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.

Listener metrics missing gha_available_jobs and gha_acquired_jobs from RunnerScaleSetStatistic

1 participant