简体   繁体   English

如何在普罗米修斯度量标准中复制标签

[英]How replicate label in prometheus metric

The metric kube_pod_container_resource_requests_cpu_cores from kube-state-metrics comes with the labels: 来自kube-state-metrics的度量kube_pod_container_resource_requests_cpu_cores带有以下标签:

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. 我想从pod另一个标签pod_name,具有相同的值。 In the end i want to have both pod="kubedns-autoscaler-5db95c6cf5-cvqz4" and pod_name="kubedns-autoscaler-5db95c6cf5-cvqz4" 最后,我想同时拥有pod="kubedns-autoscaler-5db95c6cf5-cvqz4"pod_name="kubedns-autoscaler-5db95c6cf5-cvqz4"

I used the followimng 我用了Followimng

relabel_configs:
  - source_labels: [pod]
    target_label: pod_name

but it didn't work. 但这没用。

Try to use metric_relabel_configs . 尝试使用metric_relabel_configs Your config block would look something like this: 您的配置块如下所示:

metric_relabel_configs:
  - source_labels: [pod]
    target_label: pod_name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM