The "drop" relabeling action does this. Specify the name of the label under
"labels" and the match the value under "regex". For your case,

labels: ['env']
regex: stg
action: drop

should do. You can also go the other way and use

labels: ['env']
regex: prod
action: keep

/MR

On Mon, May 11, 2020, 13:26 piyush sharma <[email protected]> wrote:

> Hello ,
>
>
> I want to achieve one thing . I have a label env which has 2 values prod
> and stage
> I want that if
>
> env = prod , then metrics should be collected and
> if
> env = stg
>
> metrics should be dropped. Is there any way I can achieve this ?
>
> I see the example below but it drops metrics based on the label name and
> not value . I want to drop metric based on label; value.
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/16222da5-e3bf-4672-a0d8-6d505fcb7587%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/16222da5-e3bf-4672-a0d8-6d505fcb7587%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CAMV%3D_gY9dS%3DbnP7_E7S68GaS_dzcUS3ZZY-VH5VgX-i3iybHEg%40mail.gmail.com.

Reply via email to