Reputation: 3897
I'm not sure if it's possible, i'd be happy know if it's the case, but:
Let's say I have a metric, that was last seen 14 days ago. How can I query prometheus for the last value over a specific range (i.e. 30 days) and what was its date??
Upvotes: 4
Views: 11183
Reputation: 304
Since 2.2.0(March 2021) prometheus release, 'last_over_time' allows you to retrieve exactly what you need:
last_over_time(my_metric[14d])
Docs: https://prometheus.io/docs/prometheus/latest/querying/functions/#aggregation_over_time
Upvotes: 7
Reputation: 203
Seems that you are looking to obtain the raw metrics which Prometheus has in it's store from a range of time. extracting raw samples from prometheus.
Upvotes: 1