Re: [prometheus-users] Re: how to drop "le="+Inf" label from kube-apiserver metrics

379 views
Skip to first unread message

Stuart Clark

unread,
Feb 16, 2021, 4:36:33 PM2/16/21
to He Wu, Prometheus Users
On 16/02/2021 12:59, He Wu wrote:
BTW, the metric_relabel_config works with below config to avoid 'le="+Inf"' lable, but same configuration with relabel_config does not work.

metric_relabel_configs:

- source_labels: [le] 

   regex: '\+Inf'

   action: 'drop'

That is correct. relabel_config is for producing a list of targets to scrape. metric_relabel_config is used later once the scape has happened against the metrics returned.

With regards to your request is there a reason for wanting to remove the metrics with those labels? The example histogram you gave needs the +Inf le entry to record all work durations above 10 seconds, so removing it will lose information. Also without the +Inf bucket the histogram_quantile() function will not work (it would return NaN).



在2021年2月16日星期二 UTC+8 下午2:35:17<He Wu> 写道:
Hi everyone,  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 . I have tried to write relabel_config to achieve , that but did not success. Cloud you please advice how is the  relabel_config should be written, thanks! 

Here is the sample matric output from kube-apiserver:
'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'

Regards,
He
--
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/7600d164-feb3-4716-b062-7348b7a1e470n%40googlegroups.com.


-- 
Stuart Clark
Reply all
Reply to author
Forward
0 new messages