diff --git a/azure-devops-client/agentpool.go b/azure-devops-client/agentpool.go index 5edaa44..4de4aac 100644 --- a/azure-devops-client/agentpool.go +++ b/azure-devops-client/agentpool.go @@ -100,16 +100,17 @@ type AgentPoolAgentList struct { } type AgentPoolAgent struct { - Id int64 - Enabled bool - MaxParallelism int64 - Name string - OsDescription string - ProvisioningState string - Status string - Version string - CreatedOn time.Time - AssignedRequest JobRequest + Id int64 + Enabled bool + MaxParallelism int64 + Name string + OsDescription string + SystemCapabilities map[string]string + ProvisioningState string + Status string + Version string + CreatedOn time.Time + AssignedRequest JobRequest } type JobRequest struct { @@ -160,7 +161,7 @@ func (c *AzureDevopsClient) ListAgentPoolAgents(agentPoolId int64) (list AgentPo c.concurrencyLock() url := fmt.Sprintf( - "/_apis/distributedtask/pools/%v/agents?includeCapabilities=false&includeAssignedRequest=true", + "/_apis/distributedtask/pools/%v/agents?includeCapabilities=true&includeAssignedRequest=true", fmt.Sprintf("%d", agentPoolId), ) response, err := c.rest().R().Get(url) diff --git a/metrics_agentpool.go b/metrics_agentpool.go index df81f53..8de34b7 100644 --- a/metrics_agentpool.go +++ b/metrics_agentpool.go @@ -77,6 +77,7 @@ func (m *MetricsCollectorAgentPool) Setup(collector *collector.Collector) { "provisioningState", "maxParallelism", "agentPoolAgentOs", + "agentPoolAgentComputerName", "enabled", "status", "hasAssignedRequest", @@ -183,16 +184,17 @@ func (m *MetricsCollectorAgentPool) collectAgentQueues(ctx context.Context, logg for _, agentPoolAgent := range list.List { agentPoolSize++ infoLabels := prometheus.Labels{ - "agentPoolID": int64ToString(agentPoolId), - "agentPoolAgentID": int64ToString(agentPoolAgent.Id), - "agentPoolAgentName": agentPoolAgent.Name, - "agentPoolAgentVersion": agentPoolAgent.Version, - "provisioningState": agentPoolAgent.ProvisioningState, - "maxParallelism": int64ToString(agentPoolAgent.MaxParallelism), - "agentPoolAgentOs": agentPoolAgent.OsDescription, - "enabled": to.BoolString(agentPoolAgent.Enabled), - "status": agentPoolAgent.Status, - "hasAssignedRequest": to.BoolString(agentPoolAgent.AssignedRequest.RequestId > 0), + "agentPoolID": int64ToString(agentPoolId), + "agentPoolAgentID": int64ToString(agentPoolAgent.Id), + "agentPoolAgentName": agentPoolAgent.Name, + "agentPoolAgentVersion": agentPoolAgent.Version, + "provisioningState": agentPoolAgent.ProvisioningState, + "maxParallelism": int64ToString(agentPoolAgent.MaxParallelism), + "agentPoolAgentOs": agentPoolAgent.OsDescription, + "agentPoolAgentComputerName": agentPoolAgent.SystemCapabilities["Agent.ComputerName"], + "enabled": to.BoolString(agentPoolAgent.Enabled), + "status": agentPoolAgent.Status, + "hasAssignedRequest": to.BoolString(agentPoolAgent.AssignedRequest.RequestId > 0), } agentPoolAgentMetric.Add(infoLabels, 1)