OpsCanary
Back to daily brief
observabilityprometheusPractitioner

Mastering Histograms and Summaries in Prometheus

5 min read Prometheus DocsApr 22, 2026
PractitionerHands-on experience recommended

Histograms and summaries in Prometheus are essential for gaining visibility into your application's performance metrics. They allow you to track and analyze response times, error rates, and other critical metrics in a way that reveals patterns and anomalies. By using histograms, you can categorize observations into buckets, while summaries help you calculate quantiles over specified time windows. This dual approach enables you to make informed decisions based on real-time data.

Prometheus collects the count and sum of observations for both histograms and summaries. In histograms, you define a set of buckets with their population counts and boundaries, which allows for granular analysis of response times. For example, using the PromQL query histogram_sum(rate(http_request_duration_seconds[5m])) gives you the total duration of HTTP requests over the last five minutes. On the other hand, summaries track pre-calculated quantiles, which can simplify the analysis of latency but may lack the flexibility of histograms. Be cautious, though: if you have negative observations, the sum of your observations might decrease, which can lead to unexpected results in your PromQL queries.

In production, understanding the nuances of histograms and summaries is crucial. Native histograms provide a single time series that combines the count and sum of observations, making it easier to manage compared to classic histograms that track these metrics separately. Additionally, consider using Native Histograms with Custom Bucket boundaries (NHCB) for more tailored insights. However, always be aware of the implications of negative observations, as they can disrupt your data integrity and analysis.

Key takeaways

  • Utilize histograms to categorize observations into buckets for detailed performance analysis.
  • Leverage summaries to track pre-configured quantiles over specific time windows.
  • Monitor for negative observations, as they can skew your sum and break assumptions in PromQL.
  • Adopt Native Histograms for a streamlined approach to tracking count and sum in a single time series.
  • Experiment with Native Histograms with Custom Bucket boundaries for tailored metrics.

Why it matters

Effective use of histograms and summaries can significantly enhance your observability strategy, allowing you to pinpoint performance bottlenecks and improve user experience based on real-time data.

Code examples

PromQL
histogram_sum(rate(http_request_duration_seconds[5m]))
  histogram_count(rate(http_request_duration_seconds[5m]))
PromQL
histogram_avg(rate(http_request_duration_seconds[5m]))
PromQL
rate(http_request_duration_seconds_sum[5m])
  rate(http_request_duration_seconds_count[5m])

When NOT to use this

The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.

Want the complete reference?

Read official docs

Test what you just learned

Quiz questions written from this article

Take the quiz →

Get the daily digest

One email. 5 articles. Every morning.

No spam. Unsubscribe anytime.