timestamp(my_metric) gives you the time at which the last sample in my_metric was recorded.
timestamp(my_metric == 1)in principle ought to give you the last time when it was 1, but I think instant queries only look back a few minutes, so you might need to use a subquery. Documentation link: https://prometheus.io/docs/prometheus/latest/querying/functions/#timestamp > -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/73c41d43-e355-4db2-88ec-e1838664fa5bo%40googlegroups.com.

