lib/promscrape/discovery/kubernetes: go fmt

This commit is contained in:
Aliaksandr Valialkin 2020-11-07 13:03:44 +02:00
parent 92bc1afcee
commit b4efe626d7
2 changed files with 5 additions and 5 deletions

View file

@ -22,13 +22,13 @@ type ObjectMeta struct {
func (om *ObjectMeta) registerLabelsAndAnnotations(prefix string, m map[string]string) { func (om *ObjectMeta) registerLabelsAndAnnotations(prefix string, m map[string]string) {
for _, lb := range om.Labels { for _, lb := range om.Labels {
ln := discoveryutils.SanitizeLabelName(lb.Name) ln := discoveryutils.SanitizeLabelName(lb.Name)
m[prefix + "_label_" + ln] = lb.Value m[prefix+"_label_"+ln] = lb.Value
m[prefix + "_labelpresent_" + ln] = "true" m[prefix+"_labelpresent_"+ln] = "true"
} }
for _, a := range om.Annotations { for _, a := range om.Annotations {
an := discoveryutils.SanitizeLabelName(a.Name) an := discoveryutils.SanitizeLabelName(a.Name)
m[prefix + "_annotation_" + an] = a.Value m[prefix+"_annotation_"+an] = a.Value
m[prefix + "_annotationpresent_" + an] = "true" m[prefix+"_annotationpresent_"+an] = "true"
} }
} }

View file

@ -95,7 +95,7 @@ func (n *Node) appendTargetLabels(ms []map[string]string) []map[string]string {
} }
addrTypesUsed[a.Type] = true addrTypesUsed[a.Type] = true
ln := discoveryutils.SanitizeLabelName(a.Type) ln := discoveryutils.SanitizeLabelName(a.Type)
m["__meta_kubernetes_node_address_" + ln] = a.Address m["__meta_kubernetes_node_address_"+ln] = a.Address
} }
ms = append(ms, m) ms = append(ms, m)
return ms return ms