You need to monitor the duration of database queries. Which metric type is best for calculating quantiles on the server side?
Trap 1: Gauge
A gauge records an instantaneous value that rises and falls, so it cannot accumulate the count and sum of observations that server-side quantile estimation requires. Gauges suit current values like temperature or queue depth, where no distribution across a window is needed.
Trap 2: Counter
A counter only increases monotonically, so it cannot capture the per-observation values needed to estimate quantiles; it tracks totals such as request counts. Counters are correct for rates and totals, not for the distribution of individual query durations.
Trap 3: Summary
Summaries compute quantiles client-side, making them less ideal for aggregation across instances.
- A
Gauge
Why it fails: A gauge records an instantaneous value that rises and falls, so it cannot accumulate the count and sum of observations that server-side quantile estimation requires. Gauges suit current values like temperature or queue depth, where no distribution across a window is needed.
- B
Counter
Why it fails: A counter only increases monotonically, so it cannot capture the per-observation values needed to estimate quantiles; it tracks totals such as request counts. Counters are correct for rates and totals, not for the distribution of individual query durations.
- C
Summary
Why it fails: Summaries compute quantiles client-side, making them less ideal for aggregation across instances.
- D
Histogram
Histograms bucket observations into configurable ranges, letting the backend compute quantiles such as p95 or p99 directly from bucket counts rather than storing every raw measurement. This satisfies the requirement to monitor query duration and calculate quantiles server-side, which summaries and gauges cannot do.