Difference between relabel_config and metric_relabel_config

533 views
Skip to first unread message

He Wu

unread,
Feb 16, 2021, 9:10:42 AM2/16/21
to Prometheus Users
Hi all,  I want to collect the kube-apiserver metrics by promethues but drop any label with 'le="+Inf"' , the other labels like 'le="1"'  and 'le="10"'  need to be kept , the metric is something like below:

'workqueue_work_duration_seconds_bucket{name="non_structural_schema_condition_controller",le="1"} 669
workqueue_work_duration_seconds_bucket{name="non_structural_schema_condition_controller",le="10"} 669
workqueue_work_duration_seconds_bucket{name="non_structural_schema_condition_controller",le="+Inf"} 669'

I have try to use "relabel_config" and "metric_relabel_confg" to achieve that, turn out "metric_relabel_confg" works , but "relabel_config" did not work with same configuration as below:

- source_labels: [le] 
   regex: '\+Inf'
   action: 'drop'

In my special use case, i need to filter the "+Inf" label before ingesting to storage, so "relabel_config" is what i need to use. cloud you please help to advise how can i filter the "+Inf" label with "relabel_config". And beside the stage they take affect, what else different between "relabel_config" and "metric_relabel_confg" , why same config can not work on "relabel_config", thanks!

Regards,
He

Aliaksandr Valialkin

unread,
Feb 16, 2021, 5:57:57 PM2/16/21
to He Wu, Prometheus Users
The `relabel_config` is applied to labels on the discovered scrape targets, while `metrics_relabel_config` is applied to metrics collected from scrape targets.

--
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/e4b661ea-1de4-4ff4-959f-ce159226cc4an%40googlegroups.com.


--
Best Regards,

Aliaksandr Valialkin, CTO VictoriaMetrics
Reply all
Reply to author
Forward
0 new messages