Repository navigation
Conversation
…or escapes stay different series
The collector's series key wrote labels as `name=value;` without
escaping, so `{a="b", c="d"}` and `{a="b;c=d"}` were one series there.
The backend keys series by the label map (view states by `LabelSet`, the
interner by length-prefixed pairs, the identity text as the map's JSON),
so it already keeps them apart. These tests pin that, over the label
sets of the collector's series-key vectors (copied from
ASAPCollector-public as testdata/collector-series-keys.json).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
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.
Summary
name=value;without escaping, so{a="b", c="d"}and{a="b;c=d"}had the same key and became one series there (fixed in Series key: write each label set as Prometheus' Labels.String(), so values holding ; or = never merge series ASAPCollector-public#65). The question for this repo was whether the backend has the same flaw.LabelSet, aBTreeMap), the series interner hashes length-prefixed name/value pairs and compares the pairs, and the identity text is the label map's canonical JSON. This PR adds tests only. They pin that behavior for the label sets in the collector's series-key vectors.Review guide
feat/collector-state-lineage(Collector view states: sequence numbers and deltas, incomplete windows, idle close from the declared delay #893, head9492be29), the head of the collector stack. The view-state test uses the lineage attributes (asap.sequence,asap.state_kind) thatstate_pointgets in Collector view states: sequence numbers and deltas, incomplete windows, idle close from the declared delay #893. The ingest code it covers is in the stack, not onmain, so this cannot go lower. The diff is tests only, so it does not conflict with the lineage and envelope work in Collector view states: sequence numbers and deltas, incomplete windows, idle close from the declared delay #893.crates/adapters/ingest/otlp/src/tests.rs(collector_key_label_sets, plus the two*_whose_values_hold_separators_are_different_seriestests) andcrates/storage/src/series_ids.rs(values_holding_separators_are_different_series).crates/adapters/ingest/otlp/testdata/collector-series-keys.jsonis a byte-for-byte copy ofasap-precompute-rs/tests/golden/series-keys.jsonfrom Series key: write each label set as Prometheus' Labels.String(), so values holding ; or = never merge series ASAPCollector-public#65. Go'sstrconv.Quoteprinted it, using the same rules as Prometheus'Labels.String().Behavior: before → after
A collector sends two view states in one request: one series with attributes
a="b",c="d", and one witha="b;c=d".a=b;c=d;: one series{"__name__":"data","a":"b","c":"d","job":…}and{"__name__":"data","a":"b;c=d","job":…}: two seriesThis PR changes no behavior. It records that the backend side of the boundary already tells label sets apart, so the collector's fix needs no matching backend change. OTLP attributes carry the labels across the boundary, never the collector's key text.
Interfaces
None (tests and test data only).
Algorithm changes
None.
Decisions and open questions
$promql_series_identitycolumn and gain nothing. Rejected.Verification
cargo test -p otlp --lib -- separatorscargo test -p storage --lib -- values_holding_separatorscargo fmt -p otlp -p storage+cargo clippy -p otlp -p storage --tests -- -D warningsNew tests:
states_whose_values_hold_separators_are_different_series: each label set from the collector vectors, sent as a view-state point, is its ownCollectorSeriesStates, whose labels are exactly the set plus__name__andjob.samples_whose_values_hold_separators_are_different_series: the same sets as raw gauge points give as many series, each with exactly its labels.values_holding_separators_are_different_series(storage): sets that collided undername=value;intern to distinct ids, and each identity text reads back (labels_of_identity,by_identity) as exactly its labels, including",\, a newline, U+0085 and CJK.The tests pass before and after. They were not failing first because this repo has no bug to fix.
Follow-ups
a.btoa_band joins attributes that rename to the same label with;, as Prometheus' OTLP receiver does. That is a deliberate merge that follows Prometheus, not a key ambiguity, so it is left as is.🤖 Generated with Claude Code
https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf