You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
query-engine: semicolon-joined group keys collide #912
Group keys are turned into strings by joining label values with ; and turned back by splitting on ;. The encoding is not injective, so distinct groups can collide:
labels
encoded
["a;b"]
a;b
["a", "b"]
a;b
[]
``
[""]
``
A label value containing ; therefore merges two groups in a sketch, and decoding splits it into the wrong label list.
extract_group_key maps a missing label to "". That matches Prometheus semantics (missing == empty) and is not part of this issue.
Fix
One lossless encoding, defined once on KeyByLabelValues and used by every site above in place of ; join/split. Proposed: a JSON array of the label values (["a;b"] vs ["a","b"]), via serde_json, which is already a dependency.
Tests
Regression: ["a;b"] / ["a","b"] and [] / [""] encode differently and round-trip exactly.
Sketch accumulators: two groups that collide today get separate estimates (CMS, HydraKLL, CMS-with-heap top-k keys).
Precompute engine end to end: a label value containing ; comes back as one label, not two.
Ordering
After #911. #911 keeps the ; encoding so its baselines isolate the sketchlib upgrade; this change moves sketch hashes on its own.
Activity