Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore or include specific metrics in prometheus?

Tags:

prometheus

I heard about ignore_metrics configuration item which can be used to ignore or include specific Prometheus metrics, but cannot find any official documentation how to use it. Anyone can help me with this?

like image 301
Mark Avatar asked Oct 30 '25 22:10

Mark


1 Answers

You can use metric_relabel_configs to filter out already scraped values. So, when you exclude any metric this way it will not be stored in db, using this approach you can reduce disk usage and exclude all not necessary metrics. e.g.:

metric_relabel_configs:
  - source_labels: [ __name__ ]
    regex: 'istio_.*'
    action: drop

in this example all metrics which name starts with istio_ will not be stored.

like image 164
Vasif Avatar answered Nov 04 '25 00:11

Vasif