Repository navigation
Conversation
`attr=key=value` was always turned into a JSON *string* containment
(`{"key":"value"}`), but OTel attributes are typed and stored as JSON
numbers/booleans, so filtering on e.g. `code.line.number=35`,
`http.status_code=500` or `retry=true` never matched anything — in the
Logs/Traces UI, the per-attribute "filter: k=v" buttons, and the MCP tools.
Parse the filter into a string form plus, when the value is a JSON number
or bool, a typed form, and OR the two containment checks. Both arms are
served by the existing jsonb_path_ops GIN indexes (BitmapOr).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #270.
What
attr=key=valuewas always compiled to a JSON-string containment, so numeric/boolean OTel attributes (code.line.number,http.status_code,retry, …) could never be matched.attr_filter()helper inapi.rs, shared byquery_tracesandquery_logs(and so the MCP tools): returns the string form plus a typed form when the value parses as a JSON number or bool; otherwise the typed form repeats the string form, so callers always bind both.attributes @> $str OR attributes @> $typed. No coercion the other way — a string attribute that looks numeric ("35") still matches via the string arm.null/arrays/objects stay string-only.jsonb_path_opsGIN index:No UI change needed: the attribute input and the "filter: k=v" buttons just start working for non-string values. Alert
match/excludeare unaffected (they're already typed JSON from config).Tests
attr_filter_adds_typed_form_for_numbers_and_bools— int, float, bool, plain strings,null/array/quoted values stay string-only,=inside the value, keyless/missing filters.attribute_filter_matches_typed_values— int/float/bool/numeric-looking-string on logs, int/bool on traces. Fails onmain(left: []), passes here.cargo fmt --check,cargo clippy --all-targets -D warnings,cargo test,scripts/lint-migrations.sh.(As in #269:
rollup_vacuum_health_canary_…fails locally against a long-lived dev DB where autovacuum has already run — same onmain, unrelated.)🤖 Generated with Claude Code