Repository navigation
lib/traceql: intersect traces by trace_id for && between spansets - #330
Closed
aloneangel45 wants to merge 2 commits into
Closed
aloneangel45 wants to merge 2 commits into
aloneangel45 wants to merge 2 commits into
Conversation
Author
|
Merged |
…et-and # Conflicts: # lib/traceql/parser_test.go
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.
Fixes #324
Root Cause
parseFilterAndpreviously emitted the same single-rowa and bLogsQL expression both inside{...}(same-span conjunction) and between spansets{...} && {...}. For queries like{ span.a = "x" } && { span.b = "y" }, LogsQL required a single span to carry both attributes, returning no traces whenaandbsit on different spans of the same trace.Fix
inSpancontext inlib/traceql/parser.goso&&inside{...}stays a single-spanandfilter, while&&between spansets is markedisSpanset: true.lib/traceql/filter_and.go,spansetString()skips wildcard (*) operands and translates multi-spanset intersections to((s0) or (s1) ...) and trace_id:in({resource_attr:service.name!=""} AND (s0) | uniq by (trace_id)) and ...so matching traces return all spans matching any operand while requiring every operand to match at least one span in the trace.TestParseQueryexpectations and addedTestSpansetAndQueryExecutionagainstlogstorage.Storagecovering parent/child spanset&&, 3-way&&, nested&&/||, stream-field spansets, and step-2FilterString()retrieval.Testing
go test -v ./lib/traceql/...— PASSgo test ./lib/... ./app/...— PASSgo vet ./lib/traceql/...— PASS