From 2b593e05dbd3aa823761330fefde3b82a7aae392 Mon Sep 17 00:00:00 2001 From: Carter Date: Thu, 31 Oct 2024 10:10:54 -0700 Subject: [PATCH] Add osDistro metric dimension (#501) --- kubetest2/internal/deployers/eksapi/k8s.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kubetest2/internal/deployers/eksapi/k8s.go b/kubetest2/internal/deployers/eksapi/k8s.go index eb8bd72ea..8c9cebe62 100644 --- a/kubetest2/internal/deployers/eksapi/k8s.go +++ b/kubetest2/internal/deployers/eksapi/k8s.go @@ -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) }