88 Help : "Time that a workflow job took to reach a given state." ,
99 Buckets : prometheus .ExponentialBuckets (1 , 1.4 , 30 ),
1010 },
11- []string {"org" , "repo" , "state" , "runner_group" },
11+ []string {"org" , "repo" , "state" , "runner_group" , "workflow_name" , "job_name" },
1212 )
1313
1414 workflowJobDurationCounter = prometheus .NewCounterVec (prometheus.CounterOpts {
1515 Name : "workflow_job_duration_seconds_total" ,
1616 Help : "The total duration of jobs." ,
1717 },
18- []string {"org" , "repo" , "status" , "conclusion" , "runner_group" },
18+ []string {"org" , "repo" , "status" , "conclusion" , "runner_group" , "workflow_name" , "job_name" },
1919 )
2020
2121 workflowJobStatusCounter = prometheus .NewCounterVec (prometheus.CounterOpts {
2222 Name : "workflow_job_status_count" ,
2323 Help : "Count of workflow job events." ,
2424 },
25- []string {"org" , "repo" , "status" , "conclusion" , "runner_group" },
25+ []string {"org" , "repo" , "status" , "conclusion" , "runner_group" , "workflow_name" , "job_name" },
2626 )
2727
2828 workflowRunHistogramVec = prometheus .NewHistogramVec (prometheus.HistogramOpts {
@@ -83,9 +83,10 @@ func init() {
8383}
8484
8585type WorkflowObserver interface {
86- ObserveWorkflowJobDuration (org , repo , state , runnerGroup string , seconds float64 )
87- CountWorkflowJobStatus (org , repo , status , conclusion , runnerGroup string )
88- CountWorkflowJobDuration (org , repo , status , conclusion , runnerGroup string , seconds float64 )
86+ ObserveWorkflowJobDuration (org , repo , state , runnerGroup , workflowName , jobName string , seconds float64 )
87+ CountWorkflowJobStatus (org , repo , status , conclusion , runnerGroup , workflowName , jobName string )
88+ CountWorkflowJobDuration (org , repo , status , conclusion , runnerGroup , workflowName , jobName string , seconds float64 )
89+
8990 ObserveWorkflowRunDuration (org , repo , workflow , conclusion string , seconds float64 )
9091 CountWorkflowRunStatus (org , repo , status , conclusion , workflow string )
9192}
@@ -94,17 +95,17 @@ var _ WorkflowObserver = (*PrometheusObserver)(nil)
9495
9596type PrometheusObserver struct {}
9697
97- func (o * PrometheusObserver ) ObserveWorkflowJobDuration (org , repo , state , runnerGroup string , seconds float64 ) {
98- workflowJobHistogramVec .WithLabelValues (org , repo , state , runnerGroup ).
98+ func (o * PrometheusObserver ) ObserveWorkflowJobDuration (org , repo , state , runnerGroup , workflowName , jobName string , seconds float64 ) {
99+ workflowJobHistogramVec .WithLabelValues (org , repo , state , runnerGroup , workflowName , jobName ).
99100 Observe (seconds )
100101}
101102
102- func (o * PrometheusObserver ) CountWorkflowJobStatus (org , repo , status , conclusion , runnerGroup string ) {
103- workflowJobStatusCounter .WithLabelValues (org , repo , status , conclusion , runnerGroup ).Inc ()
103+ func (o * PrometheusObserver ) CountWorkflowJobStatus (org , repo , status , conclusion , runnerGroup , workflowName , jobName string ) {
104+ workflowJobStatusCounter .WithLabelValues (org , repo , status , conclusion , runnerGroup , workflowName , jobName ).Inc ()
104105}
105106
106- func (o * PrometheusObserver ) CountWorkflowJobDuration (org , repo , status , conclusion , runnerGroup string , seconds float64 ) {
107- workflowJobDurationCounter .WithLabelValues (org , repo , status , conclusion , runnerGroup ).Add (seconds )
107+ func (o * PrometheusObserver ) CountWorkflowJobDuration (org , repo , status , conclusion , runnerGroup , workflowName , jobName string , seconds float64 ) {
108+ workflowJobDurationCounter .WithLabelValues (org , repo , status , conclusion , runnerGroup , workflowName , jobName ).Add (seconds )
108109}
109110
110111func (o * PrometheusObserver ) ObserveWorkflowRunDuration (org , repo , workflowName , conclusion string , seconds float64 ) {
0 commit comments