Ask Your Question
3

How do we calculate p99 over a specific time period using PromQL?

asked 2023-05-03 02:26:50 +0000

ladyg gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-05-03 02:47:01 +0000

plato gravatar image

To calculate p99 over a specific time period using PromQL, you can use the following syntax:

histogram_quantile(0.99, sum(rate(metric_name_bucket[time_range])) by (le)) 

Where metric_name is the name of the metric you want to calculate p99 for, time_range is the time period over which to calculate p99, and le is the label that represents bucket boundaries in the histogram.

For example, to calculate the p99 of the http_request_duration_seconds metric over the last 5 minutes, you can use the following query:

histogram_quantile(0.99, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))

This will return the p99 value for the http_request_duration_seconds metric over the last 5 minutes.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-03 02:26:50 +0000

Seen: 11 times

Last updated: May 03 '23