fix(querybackend): forward and apply span selector in pprof and tree query paths#5273
Merged
Merged
Conversation
…query paths The span selector was silently dropped in two places in the V2 read path, causing SelectMergeSpanProfile to return all matching samples regardless of the requested span IDs. Bug 1 (symbolizer path): backendTreeSymbolizer rewrites QUERY_TREE to QUERY_PPROF for symbolization, but PprofQuery had no span_selector field, so the selector was always lost. Fix: add span_selector to PprofQuery proto and forward it in symbolizer.go. Bug 2 (pprof backend): queryPprof always called AddSamplesFromParquetRow (no span filtering) even when a span selector was present. Fix: mirror the queryTree span-filter logic — resolve the SpanID column and route through AddSamplesWithSpanSelectorFromParquetRow when a selector is given. Also guard both queryTree and queryPprof against blocks that lack a SpanID column: early-return an empty report rather than reading the wrong column (column index 0 / StacktraceID) as span IDs. Removes the TODO comments that tracked this missing implementation.
marcsanmi
reviewed
Jun 19, 2026
aleks-p
reviewed
Jun 19, 2026
Comment on lines
+73
to
+76
| if !columns.HasSpanID() { | ||
| // Block has no SpanID column: no samples can match the span selector. | ||
| return &queryv1.Report{Pprof: &queryv1.PprofReport{Query: query.Pprof.CloneVT()}}, nil | ||
| } |
Contributor
There was a problem hiding this comment.
mostly curious, under what circumstances would this happen?
Contributor
Author
There was a problem hiding this comment.
A very old block, so something like from Phlare v0.x
Contributor
There was a problem hiding this comment.
impossible with v2 then :)
marcsanmi
approved these changes
Jun 19, 2026
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.
SelectMergeSpanProfilereturned all samples regardless of span IDs in the V2 read path due to two bugs:backendTreeSymbolizerrewritesQUERY_TREE→QUERY_PPROFfor symbolization, butPprofQueryhad nospan_selectorfield — selector was silently dropped.queryPprofalways calledAddSamplesFromParquetRowwith no span filtering even when a selector was present.Adds
span_selectortoPprofQueryproto, forwards it through the symbolizer, and applies filtering in the pprof backend. Also guards both backends against blocks without a SpanID column.