> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Prometheus Native Histograms

> Explains how Prometheus native histograms reduce metric cardinality and improve resolution compared to classic histograms, and how to enable them in scrape configuration

High cardinality from unbounded labels is a well-known problem — but classic Prometheus histograms introduce a second, often hidden, source of cardinality growth. This page explains why classic histograms can explode your time-series count, how Prometheus native histograms address the problem, and how to enable them.

Why this matters

* Excessive time series increases storage, indexing, and scrape pressure.
* Classic histograms multiply time series by the number of buckets for every unique label combination.
* Native histograms store distributions more efficiently, reducing cardinality and improving resolution where it matters.

Example: combinatorial labels
Consider instrumentation that produces many label combinations:

```text theme={null}
provider="Stripe"
provider="Stripe" && currency="usd"
provider="Stripe" && currency="usd" && result="success"
provider="Stripe" && currency="usd" && result="declined"
provider="Stripe" && currency="eur"
provider="Stripe" && currency="eur" && result="success"
provider="Stripe" && currency="eur" && result="declined"
provider="PayPal"
provider="PayPal" && currency="usd"
provider="PayPal" && currency="usd" && result="success"
provider="PayPal" && currency="usd" && result="declined"
provider="PayPal" && currency="eur"
provider="PayPal" && currency="eur" && result="success"
provider="PayPal" && currency="eur" && result="declined"
provider="Square"
provider="Square" && currency="usd"
provider="Square" && currency="usd" && result="success"
provider="Square" && currency="usd" && result="declined"
provider="Square" && currency="eur"
provider="Square" && currency="eur" && result="success"
provider="Square" && currency="eur" && result="declined"
payments_processed_total
© Copyright KodeKloud
```

Combinatorial explosion is easy to reach in practice. For example:

* 5 HTTP methods × 10 status codes × 50 endpoints = 2,500 distinct label combinations
* If your histogram uses 13 buckets, that becomes:
  * 2,500 label combinations × 13 buckets = 32,500 time series for a single histogram metric

That growth happens even when labels are well designed — it's the nature of classic histograms.

![A slide titled "Hidden Cardinality in Histograms" showing orange histogram bars with most counts at short intervals (50–500 ms) and a large outlined blue bin that aggregates values from about 1s to 5s. The vertical axis is labeled "Frequency" and the x-axis shows bin labels like 50ms, 100ms, 250ms, 500ms, 1s, 2.5s, 5s.](https://mintcdn.com/kodekloud-c4ac6d9a/qM9vA-hQoWNCxcKa/images/Grafana-Prometheus-for-Metrics-Driven-Observability/Cardinality/Prometheus-Native-Histograms/hidden-cardinality-histogram-50ms-5s-bin.jpg?fit=max\&auto=format\&n=qM9vA-hQoWNCxcKa\&q=85\&s=21e4754df511411606c8b3fd931558af)

What’s wrong with classic histograms?

* One time series per `le` bucket (plus `sum` and `count`) for each label combination.
* Bucket boundaries are fixed at instrumentation time. If the distribution changes, buckets can be either:
  * Mostly empty (wasted series/storage), or
  * Too coarse where precision is needed (poor resolution).
* Increasing the number of buckets improves precision but multiplies cardinality and costs.

How native histograms solve this

* Classic histograms: one series per bucket per label set.
* Native histograms: encode the entire distribution (buckets, sum, count) into a single sparse time series.
* Empty or unused buckets cost essentially nothing, so cardinality remains tied to the labels, not the bucket count.

Practical impact:

* The earlier example with 2,500 label combinations stays at roughly 2,500 series with native histograms instead of \~32,500 — at least a 13× reduction.
* Teams that use 20–30 buckets for better resolution can realize even larger savings.

![A slide titled "Native Histograms" showing a side-by-side comparison of Classic vs Native histograms. It lists differences across Definition, Storage, Precision, Cardinality and Best-for use cases.](https://mintcdn.com/kodekloud-c4ac6d9a/qM9vA-hQoWNCxcKa/images/Grafana-Prometheus-for-Metrics-Driven-Observability/Cardinality/Prometheus-Native-Histograms/native-vs-classic-histograms-comparison.jpg?fit=max\&auto=format\&n=qM9vA-hQoWNCxcKa\&q=85\&s=dd9540eb056c75c9ba4731ce64a4924c)

Native histograms also adapt resolution automatically. Instead of choosing fixed boundaries at instrumentation time, they typically use an exponential-like bucketing strategy and an encoding that concentrates resolution where data actually falls. This reduces the need to guess good bucket boundaries in advance.

Classic histogram example (Prometheus exposition format)

```text theme={null}
# TYPE http_request_duration_seconds histogram
http_request_duration_seconds_bucket{le="0.05"} 1847
http_request_duration_seconds_bucket{le="0.1"} 2903
http_request_duration_seconds_bucket{le="0.25"} 3187
http_request_duration_seconds_bucket{le="0.5"} 3298
http_request_duration_seconds_bucket{le="+Inf"} 3345
http_request_duration_seconds_sum 412.83
http_request_duration_seconds_count 3345
```

With native histograms, the same distribution is kept in a single encoded series rather than separate `_bucket` series for each `le` value. This reduces scrape overhead, storage, and indexing pressure.

Configuration and support

* Prometheus added experimental support for scraping native histograms around 2022; support has matured in later releases.
* Exact availability and stability depend on your Prometheus version — check the Prometheus release notes and documentation for your version.
* Enable native histograms in Prometheus scrape configuration (globally or per scrape job) using:

```yaml theme={null}
scrape_native_histograms: true
```

References and related links

* Prometheus documentation: [https://prometheus.io/docs/](https://prometheus.io/docs/)
* Prometheus querying and histogram functions: [https://prometheus.io/docs/prometheus/latest/querying/functions/](https://prometheus.io/docs/prometheus/latest/querying/functions/)
* Grafana: [https://grafana.com/](https://grafana.com/)
* Grafana Mimir: [https://grafana.com/oss/mimir/](https://grafana.com/oss/mimir/)

Native histograms are supported end-to-end: Prometheus can scrape and store them, and tools like Grafana and Mimir, along with PromQL functions such as `histogram_count`, `histogram_sum`, and `histogram_quantile`, operate natively on the encoded distribution.

Quick comparison (high level)

| Feature | Classic histograms | Native histograms |
| - | - | - |
| Series per label set | One series per bucket (+ sum/count) | Single sparse series encoding distribution |
| Cardinality impact | Multiplies by bucket count | Tied to label combinations only |
| Bucket boundaries | Fixed at instrumentation time | Adaptive/exponential-like by default |
| Best when | You must export fixed buckets to Prometheus clients | You want lower cardinality and adaptive resolution |

Takeaway

* Classic histograms are among the largest real-world drivers of cardinality in metrics systems.
* Prometheus native histograms offer a production-ready alternative that reduces cardinality and adapts resolution automatically.
* If your metrics pipeline and tooling support them, native histograms are a practical tool to control cost and improve precision.

![A presentation slide with a turquoise sidebar labeled "Takeaway." The main text reads that "Classic Histograms are one of the biggest cardinality drivers in real-world deployments."](https://mintcdn.com/kodekloud-c4ac6d9a/qM9vA-hQoWNCxcKa/images/Grafana-Prometheus-for-Metrics-Driven-Observability/Cardinality/Prometheus-Native-Histograms/takeaway-slide-classic-histograms-cardinality-drivers.jpg?fit=max\&auto=format\&n=qM9vA-hQoWNCxcKa\&q=85\&s=fbb43cc9a936a40e43c68a29f347b357)

Native histograms reduce cardinality and improve resolution where it matters, making them an important option to consider when designing your instrumentation and observability pipeline.

> [card] [Watch Video](https://learn.kodekloud.com/user/courses/grafana-prometheus-for-metrics-driven-observability/module/90070254-6cda-4097-b5a2-5c7c271512ee/lesson/d0fa6f83-6622-4f79-ae18-109bd87b8f81)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.