Re: [prometheus-users] Drop label for single metric only, not for entire scrape job

2022-02-28 Thread Julien Pivotto
On 25 Feb 03:47, 'Peter Burrows' via Prometheus Users wrote:
> Hi folks, I have a scenario where I wish to drop label *L* from metric *A*. 
> I easily found documentation on how to drop label *L* from all metrics 
> within a job, however in my case I have another metric we'll call *B* 
> that's in the same scrape job and for metric *B* label *L* is useful and 
> shouldn't be dropped. I've been unable to find anything online to help with 
> such a scenario. I basically want to drop a label for a specific metric but 
> leave it in place for all other metrics in the same job. Is anyone aware of 
> a way to achieve this, perhaps with metric_relabel_configs?

You can do:

metric_relabel_configs:
- source_labels: [__name__,L]
  target_label: L
  replacement: ""
  regex: 'A,.*'

Regards

> 
> -- 
> 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/2b6620a2-36e8-48c5-ab87-2a1faf30fe83n%40googlegroups.com.


-- 
Julien Pivotto
@roidelapluie

-- 
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/20220228125702.GA349220%40hydrogen.


[prometheus-users] Drop label for single metric only, not for entire scrape job

2022-02-28 Thread 'Peter Burrows' via Prometheus Users
Hi folks, I have a scenario where I wish to drop label *L* from metric *A*. 
I easily found documentation on how to drop label *L* from all metrics 
within a job, however in my case I have another metric we'll call *B* 
that's in the same scrape job and for metric *B* label *L* is useful and 
shouldn't be dropped. I've been unable to find anything online to help with 
such a scenario. I basically want to drop a label for a specific metric but 
leave it in place for all other metrics in the same job. Is anyone aware of 
a way to achieve this, perhaps with metric_relabel_configs?

-- 
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/2b6620a2-36e8-48c5-ab87-2a1faf30fe83n%40googlegroups.com.