diff --git a/lib/promscrape/discovery/kubernetes/common_types.go b/lib/promscrape/discovery/kubernetes/common_types.go index 039fce6a9..12de38962 100644 --- a/lib/promscrape/discovery/kubernetes/common_types.go +++ b/lib/promscrape/discovery/kubernetes/common_types.go @@ -1,7 +1,6 @@ package kubernetes import ( - "fmt" "net/url" "strings" @@ -23,13 +22,13 @@ type ObjectMeta struct { func (om *ObjectMeta) registerLabelsAndAnnotations(prefix string, m map[string]string) { for _, lb := range om.Labels { ln := discoveryutils.SanitizeLabelName(lb.Name) - m[fmt.Sprintf("%s_label_%s", prefix, ln)] = lb.Value - m[fmt.Sprintf("%s_labelpresent_%s", prefix, ln)] = "true" + m[prefix + "_label_" + ln] = lb.Value + m[prefix + "_labelpresent_" + ln] = "true" } for _, a := range om.Annotations { an := discoveryutils.SanitizeLabelName(a.Name) - m[fmt.Sprintf("%s_annotation_%s", prefix, an)] = a.Value - m[fmt.Sprintf("%s_annotationpresent_%s", prefix, an)] = "true" + m[prefix + "_annotation_" + an] = a.Value + m[prefix + "_annotationpresent_" + an] = "true" } } diff --git a/lib/promscrape/discovery/kubernetes/node.go b/lib/promscrape/discovery/kubernetes/node.go index 411b25978..02ba6b256 100644 --- a/lib/promscrape/discovery/kubernetes/node.go +++ b/lib/promscrape/discovery/kubernetes/node.go @@ -95,7 +95,7 @@ func (n *Node) appendTargetLabels(ms []map[string]string) []map[string]string { } addrTypesUsed[a.Type] = true ln := discoveryutils.SanitizeLabelName(a.Type) - m[fmt.Sprintf("__meta_kubernetes_node_address_%s", ln)] = a.Address + m["__meta_kubernetes_node_address_" + ln] = a.Address } ms = append(ms, m) return ms