PCA practice question 6 of 15
Which function would you use to calculate the 95th percentile latency from histogram data?
Full set: 60 questionsThe histogramquantile() function is specifically designed in Prometheus Query Language (PromQL) to calculate quantiles from histogram buckets. The query histogramquantile(0.95, sum(rate(httprequestdurationsecondsbucket[5m])) by (le)) correctly follows the required pattern. It first calculates the per-second rate of observations in each bucket over a 5-minute window using rate(). Then, sum(...) by (le) aggregates these rates across different instances while preserving the bucket boundary (le) label, which is essential for the quantile calculation. Finally, histogramquantile() takes this aggregated data and the desired quantile (0.95) to compute the 95th percentile value.
A. quantileovertime calculates a quantile over a time range for a gauge metric, not from the distribution provided by a histogram's buckets.
C. percentile() is not a valid function in the standard Prometheus Query Language (PromQL).
D. topk is used to select the top 'k' time series by value; it does not compute statistical percentiles from a data distribution.
1. Prometheus Authors. (n.d.). Querying functions | Prometheus Documentation.
Section: histogramquantile(φ float64, b instant-vector)
Details: The official documentation explicitly states, "Calculates the φ-quantile (0 ≤ φ ≤ 1) from the buckets b of a histogram." It provides the canonical example: histogramquantile(0.9, sum(rate(httprequestdurationsecondsbucket[10m])) by (le)), which directly supports the structure of the correct answer (B).
2. Prometheus Authors. (n.d.). Metric types | Prometheus Documentation.
Section: Histogram
Details: This document explains the structure of a histogram metric, including the bucket{le="..."} time series. It clarifies that to calculate quantiles, one must use the histogramquantile() function on the bucket series, reinforcing why option B is the correct approach.
3. Prometheus Authors. (n.d.). Querying functions | Prometheus Documentation.
Section: quantileovertime(φ float64, q range-vector)
Details: The documentation for quantileovertime confirms it calculates the φ-quantile over the values in a range vector, which is fundamentally different from calculating a quantile from a histogram's distribution of observations. This supports why option A is incorrect.
Keep practicing
Take the free PCA practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other PCA practice questions
- Question 1What function calculates the tp-quantile from a histogram?
- Question 2How can you select all the up metrics whose instance label matches the regex fe-.*?
- Question 3Which exporter would be best suited for basic HTTP probing?
- Question 4What Prometheus component would you use if targets are running behind a Firewall/NAT?
- Question 5What is the name of the official *nix OS kernel metrics exporter?
- Question 7Which PromQL expression computes the rate of API Server requests across the different clo…
