Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I drop all but a few whitelisted metrics in prometheus?

Tags:

prometheus

I am trying to drop all but a few whitelisted metrics in prometheus. I can persist them selectively with something like this:

  metric_relabel_configs:
  - source_labels: [__name__]
    regex: (?i)(metric1|metric2|metric3)
    action: keep

However I want to drop all of the other, non-matching metrics. Is there any straightforward way to do this?

like image 609
rofls Avatar asked Apr 30 '18 22:04

rofls


1 Answers

The keep action drops everything that doesn't match, so that single action is enough to do what you want.

like image 169
brian-brazil Avatar answered Nov 15 '22 15:11

brian-brazil