@@ -90,11 +90,22 @@ func (m *MetricsCollectorAgentPool) Setup(collector *CollectorAgentPool) {
9090 },
9191 )
9292
93+ m .prometheus .agentPoolQueueLength = prometheus .NewGaugeVec (
94+ prometheus.GaugeOpts {
95+ Name : "azure_devops_agentpool_queue_length" ,
96+ Help : "Azure DevOps agentpool" ,
97+ },
98+ []string {
99+ "agentPoolID" ,
100+ },
101+ )
102+
93103 prometheus .MustRegister (m .prometheus .agentPool )
94104 prometheus .MustRegister (m .prometheus .agentPoolSize )
95105 prometheus .MustRegister (m .prometheus .agentPoolAgent )
96106 prometheus .MustRegister (m .prometheus .agentPoolAgentStatus )
97107 prometheus .MustRegister (m .prometheus .agentPoolAgentJob )
108+ prometheus .MustRegister (m .prometheus .agentPoolQueueLength )
98109}
99110
100111func (m * MetricsCollectorAgentPool ) Reset () {
@@ -206,7 +217,7 @@ func (m *MetricsCollectorAgentPool) collectAgentPoolJobs(ctx context.Context, ca
206217 return
207218 }
208219
209- agentPoolQueueLength := NewMetricCollectorList ()
220+ agentPoolQueueLengthMetric := NewMetricCollectorList ()
210221
211222 notStartedJobCount := 0
212223
@@ -220,9 +231,9 @@ func (m *MetricsCollectorAgentPool) collectAgentPoolJobs(ctx context.Context, ca
220231 "agentPoolID" : int64ToString (agentPoolId ),
221232 }
222233
223- agentPoolQueueLength .Add (infoLabels , 1 )
234+ agentPoolQueueLengthMetric .Add (infoLabels , float64 ( notStartedJobCount ) )
224235
225236 callback <- func () {
226- agentPoolQueueLength .GaugeSet (m .prometheus .agentPoolAgent )
237+ agentPoolQueueLengthMetric .GaugeSet (m .prometheus .agentPoolQueueLength )
227238 }
228239}
0 commit comments