Use a temporary label to give the logic "drop if metric name is X and namespace is not Y"
Roughly like this (untested): - source_labels: [namespace] regex: 'my_interesting_namespace' target_label: __tmp_keep_namespace replacement: '1' - source_labels: [__name__, __tmp_keep_namespace] regex: 'envoy_cluster_upstream_cx_connect_ms_bucket;' action: drop - regex: __tmp_keep_namespace action: labeldrop On Tuesday 30 July 2024 at 09:40:01 UTC+1 learner wrote: > Hi Team, > > I have scrape job called - job_name: 'kubernetes-pods', there are so many > metrics being push into prometheus. But i have this bit tricky > requirement. As i want to store all metrics but for specific metric i.e > envoy_cluster_upstream_cx_connect_ms_bucket i want to store this metrics > only from specific namespace and ignore rest other namespace. > > Note: if i use keep then it will drop all other metrics on job > kubernetes-pods. So i don't want that. And i use drop then i have to > provide whole list of namespaces which is not dynamic. > > > > -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/6b881303-8d0f-4455-acfd-4123eb6b6db9n%40googlegroups.com.