admin管理员组文章数量:1305061
I created a label from our annotations on K8s Deployments named criticality
but having a hard time in having the label only on 2 specific metrics. Here is the query I have on the PodMonitor:
- action: replace
sourceLabels: [__meta_kubernetes_pod_annotation_fire_layout_criticality]
targetLabel: criticality
- action: drop
separator: ;
sourceLabels: [__name__, criticality]
regex: "(istio_request_duration_milliseconds_bucket$|istio_requests_total$).*"
The following query doesn't work. I currently only want the tag on istio_request_duration_milliseconds_bucket
and istio_requests_total
. Would appreciate any help on this.
I created a label from our annotations on K8s Deployments named criticality
but having a hard time in having the label only on 2 specific metrics. Here is the query I have on the PodMonitor:
- action: replace
sourceLabels: [__meta_kubernetes_pod_annotation_fire_layout_criticality]
targetLabel: criticality
- action: drop
separator: ;
sourceLabels: [__name__, criticality]
regex: "(istio_request_duration_milliseconds_bucket$|istio_requests_total$).*"
The following query doesn't work. I currently only want the tag on istio_request_duration_milliseconds_bucket
and istio_requests_total
. Would appreciate any help on this.
1 Answer
Reset to default 0From your config, the replace rule is adding the criticality label to all metrics, and the drop rule is trying to remove it from the ones you don’t want. Instead of applying the label everywhere and then filtering, it’s better to add it only to the specific metrics you’re concerned about.
I’ll suggest you remove the drop rule and update the replace rule like this:
- action: replace
sourceLabels: [__meta_kubernetes_pod_annotation_fire_layout_criticality, __name__]
regex: "(istio_request_duration_milliseconds_bucket|istio_requests_total)"
targetLabel: criticality
This way, the criticality label will only be added to istio_request_duration_milliseconds_bucket
and istio_requests_total
, without affecting other metrics.
本文标签: How to remove labels from specific metrics in prometheusStack Overflow
版权声明:本文标题:How to remove labels from specific metrics in prometheus? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741796835a2397986.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论