From ee8a6b95848eec3cfaf887503c916317293300bd Mon Sep 17 00:00:00 2001 From: Etienne Perot Date: Mon, 13 Mar 2023 16:09:53 -0700 Subject: [PATCH] `runsc metric-server`: Add `name_` suffix to `pod` and `namespace` labels. PiperOrigin-RevId: 516350308 --- g3doc/user_guide/observability.md | 2 +- pkg/prometheus/prometheus.go | 4 ++-- test/metricclient/metricclient.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/g3doc/user_guide/observability.md b/g3doc/user_guide/observability.md index 249df7866..ad7e2122f 100644 --- a/g3doc/user_guide/observability.md +++ b/g3doc/user_guide/observability.md @@ -265,7 +265,7 @@ non-human-friendly hexadecimal strings. In order to provide more user-friendly labels, the metric server will pick up the `io.kubernetes.cri.sandbox-name` and `io.kubernetes.cri.sandbox-namespace` annotations provided by `containerd`, and automatically add these as labels -(`pod` and `namespace` respectively) for each per-sandbox metric. +(`pod_name` and `namespace_name` respectively) for each per-sandbox metric. ## Metrics exported diff --git a/pkg/prometheus/prometheus.go b/pkg/prometheus/prometheus.go index 270524698..f645065b7 100644 --- a/pkg/prometheus/prometheus.go +++ b/pkg/prometheus/prometheus.go @@ -35,8 +35,8 @@ var timeNow = time.Now // Prometheus label names used to identify each sandbox. const ( SandboxIDLabel = "sandbox" - PodNameLabel = "pod" - NamespaceLabel = "namespace" + PodNameLabel = "pod_name" + NamespaceLabel = "namespace_name" IterationIDLabel = "iteration" ) diff --git a/test/metricclient/metricclient.go b/test/metricclient/metricclient.go index 38719b5d4..8a8b9cd25 100644 --- a/test/metricclient/metricclient.go +++ b/test/metricclient/metricclient.go @@ -360,10 +360,10 @@ func (m MetricData) GetPrometheusContainerInteger(want WantMetric) (int64, time. "sandbox": want.Sandbox, } if want.Pod != "" { - labels["pod"] = want.Pod + labels["pod_name"] = want.Pod } if want.Namespace != "" { - labels["namespace"] = want.Namespace + labels["namespace_name"] = want.Namespace } return m.GetPrometheusInteger(want.Metric, labels) }