Skip to content

Conversation

@krajorama
Copy link
Contributor

@krajorama krajorama commented Nov 28, 2025

What this PR does

Set expectations on classic histograms vs NHCBs when it comes to query results.

Which issue(s) this PR fixes or relates to

Related to #7154

Checklist

  • [N/A] Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]. If changelog entry is not needed, please add the changelog-not-needed label to the PR.
  • [N/A] about-versioning.md updated with experimental features.

Note

Clarifies query result differences between classic histograms and NHCBs and records the change in the changelog.

  • Documentation:
    • Add ## Query result equivalence section to docs/sources/mimir/send/native-histograms/_custom_buckets.md, clarifying when queries over classic histograms vs NHCBs may differ (inconsistent series, rate/increase/delta extrapolation, monotonicity warning behavior).
    • Update CHANGELOG.md with an enhancement entry noting the new guidance for native histograms vs NHCB queries.

Written by Cursor Bugbot for commit bbf7c63. This will update automatically on new commits. Configure here.

@krajorama krajorama requested review from a team and tacole02 as code owners November 28, 2025 08:35
@github-actions
Copy link
Contributor

github-actions bot commented Nov 28, 2025

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
@krajorama krajorama force-pushed the krajo/nhcb-doc-precision branch from 33fe227 to bbf7c63 Compare November 28, 2025 08:38
Copy link
Contributor

@tacole02 tacole02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs look good! I left a few minor suggestions. Thank you, @krajorama !


* [ENHANCEMENT] Add Azure object store workload identity example configuration. #13135
* [ENHANCEMENT] Ruler: clarify that internal distributor applies to both operational modes. #13300
* [ENHANCEMENT] Native histograms: set expectations on querying classic histograms versus NHCBs. #13689
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* [ENHANCEMENT] Native histograms: set expectations on querying classic histograms versus NHCBs. #13689
* [ENHANCEMENT] Native histograms: Set expectations on querying classic histograms versus NHCBs. #13689


## Query result equivalence

NHCBs contain the same information as classic histograms, however that doesn't mean that all queries return exactly the same result. Here are some edge cases when query results may be different.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NHCBs contain the same information as classic histograms, however that doesn't mean that all queries return exactly the same result. Here are some edge cases when query results may be different.
NHCBs contain the same information as classic histograms. However, this doesn't mean that all queries return exactly the same result. Here are some edge cases when query results may be different:


NHCBs contain the same information as classic histograms, however that doesn't mean that all queries return exactly the same result. Here are some edge cases when query results may be different.

- Classic histograms are stored in independent series which might be lost or delayed independently from each other, whereas NHCBs are stored in a single series. This means that a classic histogram might be inconsistent compared to an NHCB and query results will be different.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Classic histograms are stored in independent series which might be lost or delayed independently from each other, whereas NHCBs are stored in a single series. This means that a classic histogram might be inconsistent compared to an NHCB and query results will be different.
- Classic histograms are stored in independent series which might be lost or delayed independently from each other, whereas NHCBs are stored in a single series. This means that a classic histogram might be inconsistent compared to an NHCB and query results might differ.

NHCBs contain the same information as classic histograms, however that doesn't mean that all queries return exactly the same result. Here are some edge cases when query results may be different.

- Classic histograms are stored in independent series which might be lost or delayed independently from each other, whereas NHCBs are stored in a single series. This means that a classic histogram might be inconsistent compared to an NHCB and query results will be different.
- In a normal case when classic histograms series are not lot or delayed, the bucket counts, overall count and sum of observation will be equal between the classic histograms and NHCBs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- In a normal case when classic histograms series are not lot or delayed, the bucket counts, overall count and sum of observation will be equal between the classic histograms and NHCBs.
- In a normal case when classic histograms series are not lost or delayed, the bucket counts, overall count, and sum of observations are equal between the classic histograms and NHCBs.


- Classic histograms are stored in independent series which might be lost or delayed independently from each other, whereas NHCBs are stored in a single series. This means that a classic histogram might be inconsistent compared to an NHCB and query results will be different.
- In a normal case when classic histograms series are not lot or delayed, the bucket counts, overall count and sum of observation will be equal between the classic histograms and NHCBs.
- Rate, increase, and delta calculation results might differ even when both the classic histograms and NHCBs are in sync. This occurs when the rate interval overlaps with one or more buckets transitioning from being empty to being in use, which can happen if the series just came into existence or when buckets transition from 0 value to some positive value. The reason is that the PromQL function [`rate`](https://prometheus.io/docs/prometheus/latest/querying/functions/#rate) and related functions use extrapolation that is applied to classic histograms series independently resulting in potentially different 0 points and slope being calculated. For NHCBs the extrapolation is consistent across all buckets.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Rate, increase, and delta calculation results might differ even when both the classic histograms and NHCBs are in sync. This occurs when the rate interval overlaps with one or more buckets transitioning from being empty to being in use, which can happen if the series just came into existence or when buckets transition from 0 value to some positive value. The reason is that the PromQL function [`rate`](https://prometheus.io/docs/prometheus/latest/querying/functions/#rate) and related functions use extrapolation that is applied to classic histograms series independently resulting in potentially different 0 points and slope being calculated. For NHCBs the extrapolation is consistent across all buckets.
- Rate, increase, and delta calculation results might differ, even when both the classic histograms and NHCBs are in sync. This occurs when the rate interval overlaps with one or more buckets transitioning from being empty to being in use. This can happen if the series just came into existence or when buckets transition from a value of `0` to a positive value. The reason is that the PromQL function [`rate`](https://prometheus.io/docs/prometheus/latest/querying/functions/#rate) and related functions use extrapolation that is applied to classic histograms series independently resulting in potentially different calculations for `0` points and slopes. For NHCBs, the extrapolation is consistent across all buckets.

- Classic histograms are stored in independent series which might be lost or delayed independently from each other, whereas NHCBs are stored in a single series. This means that a classic histogram might be inconsistent compared to an NHCB and query results will be different.
- In a normal case when classic histograms series are not lot or delayed, the bucket counts, overall count and sum of observation will be equal between the classic histograms and NHCBs.
- Rate, increase, and delta calculation results might differ even when both the classic histograms and NHCBs are in sync. This occurs when the rate interval overlaps with one or more buckets transitioning from being empty to being in use, which can happen if the series just came into existence or when buckets transition from 0 value to some positive value. The reason is that the PromQL function [`rate`](https://prometheus.io/docs/prometheus/latest/querying/functions/#rate) and related functions use extrapolation that is applied to classic histograms series independently resulting in potentially different 0 points and slope being calculated. For NHCBs the extrapolation is consistent across all buckets.
- In general the PromQL warning "input to histogram_quantile needed to be fixed for monotonicity" that sometimes happens for classic histograms should not happen for NHCBs as NHCBs are atomic, self consistent and extrapolated consistently.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- In general the PromQL warning "input to histogram_quantile needed to be fixed for monotonicity" that sometimes happens for classic histograms should not happen for NHCBs as NHCBs are atomic, self consistent and extrapolated consistently.
- In general, the PromQL warning "input to histogram_quantile needed to be fixed for monotonicity" that sometimes happens for classic histograms should not happen for NHCBs, as NHCBs are atomic, self-consistent, and extrapolated consistently.

Copy link
Contributor

@beorn7 beorn7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving for technically correct content. I leave language to the experts. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants