Skip to content

WIP: Handling label conflicts in NHCB to classic histogram conversion - #17279

Draft
Naman-B-Parlecha wants to merge 6 commits into
prometheus:mainfrom
Naman-B-Parlecha:NamanParlecha/ConflictHandling
Draft

Naman-B-Parlecha wants to merge 6 commits into
prometheus:mainfrom
Naman-B-Parlecha:NamanParlecha/ConflictHandling

Conversation

@Naman-B-Parlecha

@Naman-B-Parlecha Naman-B-Parlecha commented Oct 4, 2025 •

Copy link
Copy Markdown
Contributor

Which issue(s) does the PR fix:

Does this PR introduce a user-facing change?

[ENHANCEMENT] : Handling label conflicts in NHCB to classic histogram conversion

As we were exploring when unrolling Native Histograms to Classic Histogram we have to rebuild the time series for histogram we go into label collision problem what it means is

We can store a native histogram like my_histogram, which can later be unrolled to classic histogram format by automatically creating multiple series with magic suffixes like my_histogram_bucket, my_histogram_count and my_histogram_sum. This creates a collision problem where you end up with two different my_histogram_bucket series.

  1. The Unrolled native histogram to classic histogram.
  2. User configured classic histogram.

In a similar way we can also have issues with “le” labels, User can configure and add in “le” labels to native histograms but this will end up clashing as when unrolling we add the custom values as “le” labels leading to a conflict in labels and series name

We will see a similar problem in Native Summaries as well, To address this issue @bwplotka recommended Honor label strategy that we could implement in this scenario

I have added

  1. _converted_to_classic_histogram suffix to avoid Series Name clash
  2. exported_ prefix to avoid label clash

Test Labels :

NHCB
{__name__="test_metric", le="1.5"}

Classic Histogram
{__name__="test_metric_converted_to_classic_histogram_bucket", exported_le="1.5", le="1"}
{__name__="test_metric_converted_to_classic_histogram_bucket", exported_le="1.5", le="+Inf"}
{__name__="test_metric_converted_to_classic_histogram_count", exported_le="1.5"}
{__name__="test_metric_converted_to_classic_histogram_sum", exported_le="1.5"}

Relevant Links:

@Naman-B-Parlecha
Naman-B-Parlecha force-pushed the NamanParlecha/ConflictHandling branch from 714420d to b01e8d8 Compare October 4, 2025 10:33
@bwplotka

bwplotka commented Oct 7, 2025

Copy link
Copy Markdown
Member

Nice, that's one way of doing this, but TBH it might need a focused proposal to really tell pros & cons and find consensus.

We initially planned to discuss this in native summaries, but honestly a separate proposal (since it also relates to unrolling nhcbs) would be useful.

So if I understand this right, for le label you propose to have user input to be copied to "external_le" which is similar to honor logic. However, for metric, it's kind of opposite - for other non nhcb series that conflict you propose to change nhcb unrolled series to have a new suffix, instead of other ones having exported prefix or suffix. I wonder if for other case an automatic label wouldn't be better 🤔 Also for le it's trivial, but for name collisions, especially on remote write we can't really detect duplicate/conflicts easily (if even in any way) - imagine with sharding and nhcb and conflicting series will go through different RW messages... In this case we would need to either:

  • Always add some special label when unrolling?
  • Describe how to deal with those conflicts on caller side (drop one 🤷🏽 )
  • Derisk this situation on write.

This can happen on push a lot, how Otel is defined to behave in this case? cc @dashpole

@dashpole

dashpole commented Oct 7, 2025

Copy link
Copy Markdown
Contributor

OTel just YOLO adds the labels and suffixes. We let scrape-time validation from client_golang catch duplicates.

@github-actions github-actions Bot added the stale label Dec 15, 2025
@krajorama

Copy link
Copy Markdown
Member

Hello from the bug scrub!

What's the status ? Is the discussion still ongoing ?

@github-actions github-actions Bot removed the stale label Mar 27, 2026
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.

4 participants