Maximum value of Long running operation duration in prometheus

17 views
Skip to first unread message

TEST TEST

unread,
Dec 3, 2020, 1:01:37 AM12/3/20
to Prometheus Users
Hi,

We are logging the duration of some long running operations to prometheus as a histogram metric.

We would like to compute the Longest/shortest running duration of the long running job with specfic date range from the histogram metric.   How can we achieve this using PromQL

b.ca...@pobox.com

unread,
Dec 3, 2020, 3:24:46 AM12/3/20
to Prometheus Users
You can't get the maximum or minimum out of a histogram.  A histogram only counts the number of occurrences within each bucket; it doesn't store the individual values.

You can get an *estimate* of (say) the 1st percentile and 99th percentile values using the histogram_quantile function.

Ben Kochie

unread,
Dec 3, 2020, 4:03:06 AM12/3/20
to b.ca...@pobox.com, Prometheus Users
You could use a subquery to get the max_over_time() of the histogram_quantile(). Warning, computing this could be very expensive, so best to have the quantile saved in a recording rule.

--
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 prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/8be18b7a-fd27-411c-9815-37dc6dd8651an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages