title: How to get the 95th percentile of an average in Prometheus?
body: <p>So I'm aware of some percentile functions in PromQL like <code>histogram_quantile</code> which is used in a case like this:</p>
  <pre><code>// Over the past 5 minutes, what's the maximum http response time experienced by 95% of our users
  histogram_quantile(0.95, rate(http_request_duration_bucket[5m])
  </code></pre>
  <p>And we can calculate the average this way:</p>
  <pre><code>// Over the past 5 mins, what the average http response time?
  avg by (webId) (rate(http_request_duration_sum[5m])/rate(http_request_duration_count[5m])
  </code></pre>
  <p>Is it possible to combine these two function to get the query that means the following:
  Over the past 5 mins, what's the maximum average HTTP response time experienced by 95% of our users? AKA 95 percentile of the AVERAGE?</p>
  <p>I tried something like:</p>
  <pre><code>histogram_quantile(0.95, avg by (webId) (rate(http_request_duration_sum[5m])/rate(http_request_duration_count[5m]))
  </code></pre>
  <p>But it doesn't seem to work. Any suggestions or gaps in my understanding?</p>