Search code examples
time-seriesprometheuspromqlprometheus-node-exporter

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

  • 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