I am trying to figure out how I can add the key value pairs of a map[string]string
into my prometheus.Labels struct.
If you've got experience with prometheus: I am trying to dynamically add labels and it's values.
labelsMap := make(map[string]string)
labelsMap["nodepool"] = "default"
labelsMap["zone"] = "europe-west"
// here I'd like to add my key / value pairs from my map
containerLabels := prometheus.Labels{
"node": "nodename",
"container": "foo",
"qos": "bar",
}
requestedContainerCPUCoresGauge.With(containerLabels).Set(containerMetric.RequestedCPUCores)
My question:
How can I dynamically add the key/value pairs from my given map labelsMap
in my containerLabels?