2
0
Эх сурвалжийг харах

Add NodeLabels one by one, instead of assigning the map of labels (#2534)

directly to the result. This protects against the case where there exist
multiple `kube_node_labels` metrics for a single node.

Signed-off-by: thomasvn <thomasnguyen96@gmail.com>
Thomas Nguyen 2 жил өмнө
parent
commit
cf0db80d81

+ 6 - 1
pkg/costmodel/cluster_helpers.go

@@ -640,7 +640,12 @@ func buildLabelsMap(
 		// ingested label data. This removes the label_ prefix that prometheus
 		// adds to emitted labels. It also keeps from ingesting prometheus labels
 		// that aren't a part of the asset.
-		m[key] = result.GetLabels()
+		if _, ok := m[key]; !ok {
+			m[key] = map[string]string{}
+		}
+		for k, l := range result.GetLabels() {
+			m[key][k] = l
+		}
 	}
 	return m
 }