Prometheus is built around returning a time series representation of metrics. In many cases, however, I only care about what the state of a metric is right now, and I'm having a hard time figuring out a reliable way to get the "most recent" value of a metric.
Since right now it's getting metrics every 30 seconds, I tried something like this:
my_metric[30s]
But this feels fragile. If metrics are dated any more or less than 30 seconds between data points, then I either get back more than one or zero results.
How can I get the most recent value of a metric?
All you need is my_metric
, which will by default return the most recent value no more than 5 minutes old.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With