'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?
Solution 1:[1]
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
Solution 2:[2]
Use the following:
memory_usage_bytes > 1024 and memory_usage_bytes <= 2048
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ivan Velichko |
| Solution 2 | Marcelo Ãvila de Oliveira |
