Ivan Velichko
Ivan Velichko

Reputation: 6709

Filter prometheus gauge metrics by value range

Prometheus does support binary comparison operators between an instant vector and a scalar. E.g. memory_usage_bytes > 1024. But is it possible to query a gauge metric that is greater than X and smaller than Y at the same time? How can I achieve something like memory_usage_bytes > 1024 && <= 2048?

Upvotes: 1

Views: 2220

Answers (2)

Ivan Velichko
Ivan Velichko

Reputation: 6709

Ok, I think I figured it out. A query like this would return metrics within a value range:

(go_gc_duration_seconds > 0.0002) < 0.0006

Upvotes: 4

Use the following:

memory_usage_bytes > 1024 and memory_usage_bytes <= 2048

Upvotes: 0

Related Questions