Skip to content

PROM-39: Provide PromQL info annotations when series with the same name have mismatched type or unit#16841

Open
carrieedwards wants to merge 5 commits intomainfrom
cedwards/type-unit-annotations
Open

PROM-39: Provide PromQL info annotations when series with the same name have mismatched type or unit#16841
carrieedwards wants to merge 5 commits intomainfrom
cedwards/type-unit-annotations

Conversation

@carrieedwards
Copy link
Copy Markdown
Contributor

This PR adds a wrapper around storage.Storage in order to track the type and unit of series with the same name, and return an info annotation when the type and/or unit mismatch.

Part of #16610. Addresses #16641.

@carrieedwards carrieedwards requested a review from bwplotka July 7, 2025 17:25
@carrieedwards carrieedwards force-pushed the cedwards/type-unit-annotations branch from b4e2329 to 6797162 Compare July 7, 2025 18:22
// AnnotatingStorage wraps given storage and tracks type and unit
// labels across series. It will produce an info annotation if there
// is a mismatch between type or unit in series with the same name.
func AnnotatingStorage(s Storage) Storage {
Copy link
Copy Markdown
Member

@bwplotka bwplotka Jul 8, 2025

Choose a reason for hiding this comment

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

Hm, why generic name ("annotating"?); Would more specific name be a bit better e.g. the exact semantics for annotations (SchemaMismatchStorage or MismatchStorage TypeAndUnitMismatchStorage)?

mType := series.Labels().Get("__type__")
mUnit := series.Labels().Get("__unit__")

if prev, ok := s.seen[metric]; ok {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need to maintain a full map here? I was thinking that for the single seriesSet coming from storage for a single Select, we really only expect a single type and unit, so just prevType and prevUnit would suffice. What are the cases where it's not true? 🤔

Copy link
Copy Markdown
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Looks great, I like the place we inject this functionality! Some initial questions, otherwise looks nice!

@beorn7
Copy link
Copy Markdown
Member

beorn7 commented Nov 18, 2025

Stumbled upon this during bug scrub. This has been sitting for a while. What's the plan here?
(I added some thought on the issue #16641 . But I don't have a lot of context on this. I might be mistaken.)

@krajorama
Copy link
Copy Markdown
Member

Hello from the bug scrub!

Same question as before, what is the status of this work ? Sounds interesting.

@carrieedwards
Copy link
Copy Markdown
Contributor Author

This was originally being done for the type and unit/delta work. If there's interest, I can look back into it

@github-actions github-actions bot removed the stale label Mar 24, 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