Filter specific metrics before scraping


I have a node_exporter pod in Kubernetes, and I was curious about how I can filter/( drop or keep) specific metrics before scraping them. For example in CPU collector, what should I do to filter node_cpu_core_throttles_total or with regex node_cpu_core* metric/s?
I know there is a relable_configs but __ name __ source label does not work to filter specific metrics I am looking for.
And metric_relabel_configs is not useful for my case, because it filters the metrics after scraping.

The only way to drop things without having already scraped them (ie using metric_relabel) is for the metric not to have been exposed for scraping in the first place. This is totally down to the exporter and what (if any) configuration options it gives.

If there are no options in the exporter then the metric will be scraped, but you could then subsequently drop it. Is there a reason why you don’t want to ingest that metric?

1 Like

Thank you very much for your answer. So I am trying to reduce the network bandwidth that is being used by monitoring metrics such as node_exporter.

So you need to check the exporter documentation to see what options there are to choose the metrics being exposed

1 Like