mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-29 05:18:50 +08:00
Use head_branch metric (#2549)
Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
gogithub "github.com/google/go-github/v50/github"
|
||||
gogithub "github.com/google/go-github/v52/github"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
"github.com/actions/actions-runner-controller/github"
|
||||
@@ -98,13 +98,19 @@ func (reader *EventReader) ProcessWorkflowJobEvent(ctx context.Context, event in
|
||||
labels["organization"] = org
|
||||
|
||||
var wn string
|
||||
var hb string
|
||||
if e.WorkflowJob != nil {
|
||||
if n := e.WorkflowJob.WorkflowName; n != nil {
|
||||
wn = *n
|
||||
keysAndValues = append(keysAndValues, "workflow_name", *n)
|
||||
}
|
||||
if n := e.WorkflowJob.HeadBranch; n != nil {
|
||||
hb = *n
|
||||
keysAndValues = append(keysAndValues, "head_branch", *n)
|
||||
}
|
||||
}
|
||||
labels["workflow_name"] = wn
|
||||
labels["head_branch"] = hb
|
||||
|
||||
log := reader.Log.WithValues(keysAndValues...)
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ func metricLabels(extras ...string) []string {
|
||||
}
|
||||
|
||||
var (
|
||||
commonLabels = []string{"runs_on", "job_name", "organization", "repository", "repository_full_name", "owner", "workflow_name"}
|
||||
commonLabels = []string{"runs_on", "job_name", "organization", "repository", "repository_full_name", "owner", "workflow_name", "head_branch"}
|
||||
githubWorkflowJobQueueDurationSeconds = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Name: "github_workflow_job_queue_duration_seconds",
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
gogithub "github.com/google/go-github/v50/github"
|
||||
gogithub "github.com/google/go-github/v52/github"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
|
||||
"github.com/actions/actions-runner-controller/github"
|
||||
|
||||
Reference in New Issue
Block a user