Skip to content

Commit

Permalink
prevent panic if computer name is missing
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Blaschke <[email protected]>
  • Loading branch information
mblaschke committed Feb 9, 2025
1 parent e01c946 commit 6f24dd4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion metrics_agentpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ func (m *MetricsCollectorAgentPool) collectAgentQueues(ctx context.Context, logg
agentPoolUsed := 0
for _, agentPoolAgent := range list.List {
agentPoolSize++

agentComputerName := ""
if val, exists := agentPoolAgent.SystemCapabilities["Agent.ComputerName"]; exists {
agentComputerName = val
}

infoLabels := prometheus.Labels{
"agentPoolID": int64ToString(agentPoolId),
"agentPoolAgentID": int64ToString(agentPoolAgent.Id),
Expand All @@ -191,7 +197,7 @@ func (m *MetricsCollectorAgentPool) collectAgentQueues(ctx context.Context, logg
"provisioningState": agentPoolAgent.ProvisioningState,
"maxParallelism": int64ToString(agentPoolAgent.MaxParallelism),
"agentPoolAgentOs": agentPoolAgent.OsDescription,
"agentPoolAgentComputerName": agentPoolAgent.SystemCapabilities["Agent.ComputerName"],
"agentPoolAgentComputerName": agentComputerName,
"enabled": to.BoolString(agentPoolAgent.Enabled),
"status": agentPoolAgent.Status,
"hasAssignedRequest": to.BoolString(agentPoolAgent.AssignedRequest.RequestId > 0),
Expand Down

0 comments on commit 6f24dd4

Please sign in to comment.