labeldrop

35 views
Skip to first unread message

Steve

unread,
Feb 24, 2020, 6:03:40 PM2/24/20
to Prometheus Users
Hi
labeldrop is straightforward when you know the label to drop.
What if the labels are not known or the list is too long?

For instance. 
After relabel_configs, I have the following labels in my timeseries:
- job
- instance
- pod_name
- namespace

What should be the metric_relabel_configs to drop all other labels?
Does regex support negative matches?

Thank you

-Steve


Julien Pivotto

unread,
Feb 24, 2020, 6:06:29 PM2/24/20
to Steve, Prometheus Users
You can use labelkeep.

- regex: "(job|instance|pod_name|namespace)"
action: labelkeep

Note, as per doc:
Care must be taken with labeldrop and labelkeep to ensure that metrics
are still uniquely labeled once the labels are removed.

>
>
> --
> 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-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/506ab0cf-8a0b-4ebb-b5ab-ead424ad220e%40googlegroups.com.


--
(o- Julien Pivotto
//\ Open-Source Consultant
V_/_ Inuits - https://www.inuits.eu
signature.asc
Reply all
Reply to author
Forward
0 new messages