mirror of
https://github.com/prometheus/prometheus.git
synced 2026-07-06 15:57:03 -04:00
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>
|
||
|---|---|---|
| .. | ||
| almost | ||
| annotations | ||
| compression | ||
| convertnhcb | ||
| documentcli | ||
| features | ||
| fmtutil | ||
| fuzzing | ||
| gate | ||
| httputil | ||
| jsonutil | ||
| junitxml | ||
| kahansum | ||
| logging | ||
| namevalidationutil | ||
| netconnlimit | ||
| notifications | ||
| osutil | ||
| pool | ||
| runtime | ||
| runutil | ||
| stats | ||
| strutil | ||
| testrecord | ||
| teststorage | ||
| testutil | ||
| testwal | ||
| treecache | ||
| zeropool | ||