Timestamp of last metric change

Hi all,

I am using Grafana and prometheus and I am trying to get the timestamp at which a given metric last had it’s value changed. Based on information found here : https://stackoverflow.com/questions/54148451/get-time-that-passed-since-the-last-increase-of-prometheus-counter, I tried several queries in prometheus server interface like :

timestamp(changes(up{job="prometheus"}[1h]) > 0) * 1000

But I cannot figure out how to get the timestamp at which my metric last changed it’s value.
I either get query execution errors when trying to filter results, or end up getting the timestamp of the last time the metric was scraped.

Can someone tell me if this is possible using PromQL. Or if there is a way to do this in Grafana ?

@yanick Did you got the solution… Asking after 3 years… Hope you didn’t forge the answer

I’m also running into this issue. I have a counter metric that only fires in rare cases. I want to compare the last timestamp of a non-null value for this counter to a different ts. Have been trying all kinds of operators and functions and like the original poster, end up with a vector of ts of the last scrape or query errors.