[k8s-checker] Fix tags for pod metrics
Bug: skia:10543
Change-Id: Ieadc7e631d40ce457c735d10e9fae1fb168074d6
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/306816
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
diff --git a/k8s-checker/go/k8s-checker/main.go b/k8s-checker/go/k8s-checker/main.go
index 885ecd4..6f63e02 100644
--- a/k8s-checker/go/k8s-checker/main.go
+++ b/k8s-checker/go/k8s-checker/main.go
@@ -109,12 +109,10 @@
for _, p := range pods.Items {
for _, c := range p.Status.ContainerStatuses {
tags := map[string]string{
+ "app": p.Labels["app"],
"pod": p.ObjectMeta.Name,
"container": c.Name,
}
- if app, ok := p.Labels["app"]; ok {
- tags["app"] = app
- }
restarts := metrics2.GetInt64Metric(POD_RESTART_COUNT_METRIC, tags)
restarts.Update(int64(c.RestartCount))
metrics[restarts] = struct{}{}