feat: Add owner to job metrics

Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
This commit is contained in:
Marcel Müller 2026-02-15 16:10:09 +01:00 committed by Gabriel
parent c8bdf373d3
commit 90fe8c9a57
3 changed files with 5 additions and 3 deletions

View file

@ -366,9 +366,9 @@ This is one of the features in GARM that I really love having. For one thing, it
### Job metrics
| Metric name | Type | Labels | Description |
|---------------------------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|
| `garm_job_status` | Gauge | `job_id`=&lt;job id&gt; <br>`name`=&lt;job name&gt; <br>`status`=&lt;job status&gt; <br>`conclusion`=&lt;job conclusion&gt; <br>`runner_name`=&lt;runner name&gt; <br>`repository`=&lt;repository&gt; <br>`requested_labels`=&lt;requested labels&gt; | List of jobs and their status |
| Metric name | Type | Labels | Description |
|-------------------|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|
| `garm_job_status` | Gauge | `job_id`=&lt;job id&gt; <br>`workflow_job_id`=&lt;workflow job id&gt; <br>`scaleset_job_id`=&lt;scaleset job id&gt; <br>`workflow_run_id`=&lt;workflow run id&gt; <br>`name`=&lt;job name&gt; <br>`status`=&lt;job status&gt; <br>`conclusion`=&lt;job conclusion&gt; <br>`runner_name`=&lt;runner name&gt; <br>`owner`=&lt;owner&gt; <br>`repository`=&lt;repository&gt; <br>`requested_labels`=&lt;requested labels&gt; | List of jobs and their status |
### Github metrics

View file

@ -32,6 +32,7 @@ var JobStatus = prometheus.NewGaugeVec(prometheus.GaugeOpts{
"status",
"conclusion",
"runner_name",
"owner",
"repository",
"requested_labels",
})

View file

@ -43,6 +43,7 @@ func CollectJobMetric(ctx context.Context, r *runner.Runner) error {
job.Status, // label: status
job.Conclusion, // label: conclusion
job.RunnerName, // label: runner_name
job.RepositoryOwner, // label: owner
job.RepositoryName, // label: repository
strings.Join(job.Labels, " "), // label: requested_labels
).Set(1)