Tapxxor Stanijkis
Tapxxor Stanijkis

Reputation: 81

How replicate label in prometheus metric

The metric kube_pod_container_resource_requests_cpu_cores from kube-state-metrics comes with the labels:

kube_pod_container_resource_requests_cpu_cores{app="prometheus",chart="prometheus-8.1.0",component="kube-state-metrics",container="autoscaler",heritage="Tiller",instance="10.233.65.93:8080",job="kubernetes-service-endpoints",kubernetes_name="prometheus-kube-state-metrics",kubernetes_namespace="kube-system",kubernetes_node="k8st01",namespace="kube-system",node="k8snode",pod="kubedns-autoscaler-5db95c6cf5-cvqz4",release="prometheus"}

I want to make another label pod_name from pod , with the same values. In the end i want to have both pod="kubedns-autoscaler-5db95c6cf5-cvqz4" and pod_name="kubedns-autoscaler-5db95c6cf5-cvqz4"

I used the followimng

relabel_configs:
  - source_labels: [pod]
    target_label: pod_name

but it didn't work.

Upvotes: 2

Views: 2027

Answers (1)

Oliver
Oliver

Reputation: 12981

Try to use metric_relabel_configs. Your config block would look something like this:

metric_relabel_configs:
  - source_labels: [pod]
    target_label: pod_name

Upvotes: 1

Related Questions