Can Metrics be Whitlisted (Scrape None by Default Unless Enabled)?

985 views
Skip to first unread message

cla...@qbox.io

unread,
Apr 3, 2018, 4:21:58 PM4/3/18
to Prometheus Users
Hi, Prometheus community!!

As the subject states, is there any way to have a metrics whitelist, instead of blacklisting metrics in the relabeling configs? This would mean specifying less metrics for us and using less greedy regular expressions for us, as we scrape very little in order to reduce usage as much as possible.

For example, instead of this:
metric_relabel_configs:
- source_labels:
- __name__
regex: go_.*|admission_.*|apiserver_request_latencies_summary|cluster_resource_verb:apiserver_latency:quantile_seconds|apiserver_request_count|etcd_request_latencies_summary|http_.*
action: drop

Is it possible to do something sort of like this:
metric_relabel_configs:
- source_labels:
- __name__
regex: cpu_metric_1|volume_mount_filesystem_free|other_cool_metric
action: keep

I'm a little bit new to this and can't find my answer elsewhere, so thanks for your time!
 - Clarke

Brian Brazil

unread,
Apr 3, 2018, 4:41:23 PM4/3/18
to cla...@qbox.io, Prometheus Users
Yes that should work, but why do you want to drop so many metrics?
 
--

Clarke Vennerbeck

unread,
Apr 3, 2018, 8:13:22 PM4/3/18
to Brian Brazil, Prometheus Users
Hey, Brian, thanks for responding to me, I really appreciate it! We're trying to get Prometheus as light as possible to save a little money, but I may be going about this the wrong way. But I might be able to use keep instead of drop, and all other labels will be dropped by default?

Brian Brazil

unread,
Apr 4, 2018, 3:11:17 AM4/4/18
to Clarke Vennerbeck, Prometheus Users
On 4 April 2018 at 01:13, Clarke Vennerbeck <cla...@qbox.io> wrote:
Hey, Brian, thanks for responding to me, I really appreciate it! We're trying to get Prometheus as light as possible to save a little money, but I may be going about this the wrong way.

This is probably micro-optimising. Prometheus is quite cheap to run as these things go.
 
But I might be able to use keep instead of drop, and all other labels will be dropped by default?

Keep and drop affect time series as a whole, not individual labels.

Brian
 

On Tue, Apr 3, 2018 at 3:41 PM Brian Brazil <brian.brazil@robustperception.io> wrote:
On 3 April 2018 at 21:21, <cla...@qbox.io> wrote:
Hi, Prometheus community!!

As the subject states, is there any way to have a metrics whitelist, instead of blacklisting metrics in the relabeling configs? This would mean specifying less metrics for us and using less greedy regular expressions for us, as we scrape very little in order to reduce usage as much as possible.

For example, instead of this:
metric_relabel_configs:
- source_labels:
- __name__
regex: go_.*|admission_.*|apiserver_request_latencies_summary|cluster_resource_verb:apiserver_latency:quantile_seconds|apiserver_request_count|etcd_request_latencies_summary|http_.*
action: drop

Is it possible to do something sort of like this:
metric_relabel_configs:
- source_labels:
- __name__
regex: cpu_metric_1|volume_mount_filesystem_free|other_cool_metric
action: keep

I'm a little bit new to this and can't find my answer elsewhere, so thanks for your time!

Yes that should work, but why do you want to drop so many metrics?
 
--



--

Clarke Vennerbeck

unread,
Apr 4, 2018, 8:39:47 AM4/4/18
to Brian Brazil, Prometheus Users
Ok, thanks! That makes more sense--I'll play around with Prometheus more and try to learn some more about it.
Reply all
Reply to author
Forward
0 new messages