Skip to content

Commit

Permalink
Add osDistro metric dimension (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
cartermckinnon authored Oct 31, 2024
1 parent 652d01a commit 2b593e0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions kubetest2/internal/deployers/eksapi/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,19 @@ func emitNodeMetrics(metricRegistry metrics.MetricRegistry, k8sClient *kubernete
"arch": node.Status.NodeInfo.Architecture,
}

var osDistro string
if strings.HasPrefix(node.Status.NodeInfo.OSImage, "Amazon Linux") {
// on al2: "Amazon Linux 2"
// on al2023: "Amazon Linux 2023.6.20241010"
parts := strings.Split(node.Status.NodeInfo.OSImage, ".")
amazonLinuxMajorVersion := parts[0]
osDistro = amazonLinuxMajorVersion
}

if osDistro != "" {
nodeDimensions["osDistro"] = osDistro
}

metricRegistry.Record(nodeTimeToRegistrationSeconds, timeToRegistration.Seconds(), nodeDimensions)
metricRegistry.Record(nodeTimeToReadySeconds, timeToReady.Seconds(), nodeDimensions)
}
Expand Down

0 comments on commit 2b593e0

Please sign in to comment.