Skip to content

Commit

Permalink
ACCDT-1238: Add runner_name label (#2)
Browse files Browse the repository at this point in the history
* add runner_name as extra label

* check for existence of runner name

* keep consistency of cardinality
  • Loading branch information
sindunuragarp authored Nov 14, 2023
1 parent 9a442df commit be1bfcb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pkg/actionsmetrics/event_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ func (reader *EventReader) ProcessWorkflowJobEvent(ctx context.Context, event in
githubWorkflowJobQueueDurationSeconds.With(labels).Observe(parseResult.QueueTime.Seconds())

case "completed":
githubWorkflowJobsCompletedTotal.With(labels).Inc()
var rn string
if n := e.WorkflowJob.RunnerName; n != nil {
rn = *n
}
githubWorkflowJobsCompletedTotal.With(extraLabel("runner_name", rn, labels)).Inc()

// job_conclusion -> (neutral, success, skipped, cancelled, timed_out, action_required, failure)
githubWorkflowJobConclusionsTotal.With(extraLabel("job_conclusion", *e.WorkflowJob.Conclusion, labels)).Inc()
Expand Down
2 changes: 1 addition & 1 deletion pkg/actionsmetrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ var (
Name: "github_workflow_jobs_completed_total",
Help: "Total count of workflow jobs completed (events where job_status=completed)",
},
metricLabels(),
metricLabels("runner_name"),
)
githubWorkflowJobFailuresTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Expand Down

0 comments on commit be1bfcb

Please sign in to comment.