prometheus/docs
György Krajcsovits db46de3dcb
feat(api): add histogram_format=native to query endpoints
Add a new optional histogram_format query parameter to /api/v1/query
and /api/v1/query_range. When set to native, native histograms in the
JSON response are emitted in a schema-aware shape.

For exponential schemas:

  {
    "count":          "<count>",
    "sum":            "<sum>",
    "schema":         <int>,
    "zero_threshold": "<threshold>",
    "zero_count":     "<count>",                       // when non-zero
    "negative_buckets": [ [ <index>, "<count>" ], ... ], // when non-empty
    "buckets":          [ [ <index>, "<count>" ], ... ]  // when non-empty
  }

zero_threshold is always emitted because, together with schema, it
fully describes the bucket layout. The negative/positive bucket
arrays carry the schema-defined bucket index and count, so empty
buckets that fall between non-empty ones are not transmitted.

For custom-bucket histograms (schema -53):

  {
    "count":      "<count>",
    "sum":        "<sum>",
    "schema":     -53,
    "boundaries": [ "<upper_bound>", ... ],
    "buckets":    [ [ <index>, "<count>" ], ... ]
  }

boundaries lists the bucket upper bounds; each bucket entry's index
is the 0-based index into boundaries.

This lets clients that already understand the schema (e.g. Grafana
rendering NHCB heatmaps) reconstruct every bucket including empty
custom-bucket slots, and is also substantially more compact than the
boundary-based representation for histograms with many buckets.

The existing boundary-based representation is unchanged when
histogram_format is absent or set to any other value.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2026-05-22 19:13:40 +02:00
..
command-line web/api: add search API endpoint (#18573) 2026-05-19 13:58:00 +02:00
configuration Use a default IPv6 address for IPv6 only instances 2026-04-29 19:58:17 +01:00
images prometheus-agent-documentation 2024-07-27 14:21:24 +01:00
querying feat(api): add histogram_format=native to query endpoints 2026-05-22 19:13:40 +02:00
feature_flags.md Merge pull request #18687 from roidelapluie/roidelapluie/greatest_least 2026-05-21 10:34:29 +02:00
federation.md feat(nh): mark native histograms as stable in docs 2025-10-24 12:31:42 +02:00
getting_started.md docs(): fix gettingStarted outdated graph reference 2025-09-15 17:31:18 +02:00
http_sd.md fix(discovery): delete expired refresh metrics on reload (#17614) 2026-04-02 13:43:35 +01:00
index.md Update Prometheus Agent doc (#17591) 2025-11-21 11:34:19 +01:00
installation.md Standardize doc page title handling 2025-05-28 21:37:27 +02:00
management_api.md Standardize doc page title handling 2025-05-28 21:37:27 +02:00
migration.md Merge pull request #16155 from LukoJy3D/docs/migration/clarify_on_content_type_headers 2026-03-31 12:58:48 +01:00
prometheus_agent.md fix(docs): typo in prometheus_agent.md doc 2026-02-08 19:02:56 +03:30
stability.md chore: exclude experimental /v1/ endpoints from stability guarantees 2025-08-12 16:45:17 +02:00
storage.md Merge pull request #14317 from anarcat/wal-backups 2025-12-16 11:35:43 +00:00