When using action: drop: relabel_configs drop targets before they are scraped
metric_relabel_configs drop metrics after they are scraped If the `uid` label comes from the target, you need to use metric_relabel_configs. On Mon, Jun 8, 2020 at 6:28 PM Stuart Clark <[email protected]> wrote: > On 08/06/2020 16:53, Tomer Leibovich wrote: > > Hi, > > I'm monitoring my K8s environment using prometheus-operator chart. > I'm trying to understand how can I drop certain metrics, for example, if I > do > kube_pod_info{namespace="monitoring"} > I will have the following output: > > > kube_pod_info{created_by_kind="DaemonSet",created_by_name="prom-operator-prometheus-node-exporter",endpoint="http",host_ip="192.168.83.60",instance=" > 10.133.86.207:8080 > ",job="kube-state-metrics",namespace="monitoring",node="node2",pod="prom-operator-prometheus-node-exporter-nrck9",pod_ip="192.168.83.60",service="prom-operator-kube-state-metrics",uid="ecd029bf-e998-4b7b-a0dc-7eeefec25668"} > > So I'm trying to understand how I can drop from here the UID part. > > I've tried creating the following relabel_config: > relabelings: > - sourceLabels: [uid] > action: drop > > It did nothing. > Also, I've tried: > - action: drop > regex: 'uid.+' > sourceLabels: [uid] > > And this did nothing as well... > > Any help to understand it will be very much appreciated. > > > > The drop action is to drop whole metrics. You want labeldrop. You are also > missing the "regex" parameter. > > > https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config > > > -- > Stuart Clark > > -- > 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/c99438f0-5274-a42f-2e70-fb224b24db87%40Jahingo.com > <https://groups.google.com/d/msgid/prometheus-users/c99438f0-5274-a42f-2e70-fb224b24db87%40Jahingo.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/CABbyFmrZzUGxxUYb5mpFk-sLi%2B0af4rEt2RqwNR1Dhe%2BtiDRpw%40mail.gmail.com.

