Conversation
This was referenced Sep 30, 2026
zzylol
force-pushed
the
feat/per-series-binary
branch
from
September 30, 2026 18:27
ab6c642 to
3f0d2e2
Compare
zzylol
force-pushed
the
fix/series-labels-duplicates
branch
from
September 30, 2026 18:27
17d1c12 to
ad45318
Compare
PromQL arithmetic with a literal drops `__name__`; if two series then
share a label set, Prometheus errors ("vector cannot contain metrics with
the same labelset"). The per-series literal path returned both rows, and
the Fallback literal path kept `__name__` altogether.
Add `Operator::series_without_name`, a `SeriesLabels` rewrite that errors
on equal resulting label sets, and use it for both literal paths. Matching
and `without` relabeling still tolerate repeats: `series_binary` already
rejects right-hand and matched left-hand duplicates, and aggregation
merges them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zzylol
force-pushed
the
feat/per-series-binary
branch
from
September 30, 2026 20:24
3f0d2e2 to
000c1ef
Compare
zzylol
force-pushed
the
fix/series-labels-duplicates
branch
from
September 30, 2026 20:24
ad45318 to
d0f5f97
Compare
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #489.
Why
PromQL arithmetic with a literal drops
__name__. If two series then have the same label set, Prometheus fails with "vector cannot contain metrics with the same labelset". An independent review of backend #801 found that Planner returned both rows instead.What
Operator::series_without_name: aSeriesLabelsrewrite that drops__name__and errors when two rows end up with the same label set.Binaryover stored readouts (feat: compile per-series vector arithmetic and match Prometheus summation #489), and the Fallback literal path, which previously kept__name__.withoutrelabeling still allow repeated label sets.series_binaryalready rejects right-hand duplicates and left-hand duplicates that match (feat: compile multi-selector PromQL subtrees and more range functions #487), andwithoutaggregation merges repeats, as Prometheus does.Before this PR
Series
m{job="api",instance="x"}andn{job="api",instance="x"}, evaluated assum_over_time(m[5m]) * 2, returned two identical{instance="x",job="api"}series. The Fallbacka * 2returned rows that still had__name__="a".After this PR
Both paths fail with
vector cannot contain metrics with the same labelset. Series that stay distinct are unaffected, and the Fallbacka * 2now drops__name__.Validation
per_series_scalar_arithmetic_rejects_label_sets_equal_without_the_nameandliteral_arithmetic_drops_the_name_and_rejects_equal_label_sets. A newwithoutcase confirms that series equal after dropping the name are grouped, not rejected.cargo fmt --all -- --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace --no-fail-fast: all pass.🤖 Generated with Claude Code