Repository navigation
Description
Summary
The search bar evaluates AND at the span/row level. There is no way to express a trace-level filter: return traces where property A appears on some span and property B appears on a (possibly different) span in the same trace.
That is a common query when correlation IDs are stamped once at the edge and service name (or other attributes) live on downstream spans.
Problem
A query like:
SpanAttributes.tuid:"abc123" AND ServiceName:checkout-service
Expected (Jaeger / Haystack / many APM UIs): traces that contain both predicates, even if they sit on different spans.
Actual: 0 results unless a single span has both fields.
This is easy to misread as a bug. The search bar is doing what it was built to do — filtering rows. The gap is that trace-level, cross-span AND is not expressible there.
Why this happens
Typical OpenTelemetry instrumentation stamps a correlation ID (request ID, tenant ID, user ID, etc.) on the gateway/entry span. Downstream services appear as separate spans in the same trace and often do not copy that ID onto every child.
So a real trace can look like:
| Span | ServiceName | tuid |
|---|---|---|
| entry | gateway-service | abc123 |
| child | checkout-service | (unset) |
- Trace-level
ANDmatches this trace - Span-level
ANDmatches nothing
Current workaround
Intersect two TraceId sets outside the where bar:
TraceIds where any span hastuid = XTraceIds where any span hasServiceName = Y- Fetch full traces for the intersection
That works against ClickHouse, but it is not something a user can do from the search bar.
Proposed behavior
Support a trace-scoped search mode (or syntax) where boolean operators apply at the trace:
A AND B→ traces that contain a span matching A and a span matching B- Keep today’s span-level
ANDas an explicit mode, since it is still useful (“this span is slow and this span ischeckout-service”)
Jaeger, Haystack, and several commercial APM products default to the trace-level interpretation for this class of query.
Additional context
Verified directly in ClickHouse on otel_traces-style data: the traces exist; no single row satisfies both predicates. Happy to share a minimal SQL sketch of the TraceId intersection if useful.
Activity
milansanjeev commentedon Sep 3, 2026
Proposed approach: trace-scoped filter matching, built on the existing
filtersarrayDug into the query pipeline to scope this. Summary of where things stand and a concrete, contained proposal for an MVP.
Today: a Lucene/SQL
wherestring is parsed once and flattened into a single boolean SQL expression evaluated per-row (packages/common-utils/src/queryParser.ts'sserialize()) -- there's no per-clause independence there. But the search page already has a parallel, more structured mechanism: thefiltersarray +filtersLogicalOperator(packages/app/src/DBSearchPage.tsx), where eachFilteris rendered independently (renderWhereExpression) and then joined byAND/OR(renderChartConfig.ts'srenderWhere(), ~line 1459). That's a much better foundation for this feature than the raw where-bar text, because each filter chip is already a self-contained, independently-renderable condition.Proposed MVP: a "Match across trace" toggle (only surfaced/meaningful for Trace-kind sources), scoped to the
filtersarray:IN (...)conditions are ANDed together in the outer query -- sotuid:"abc123" AND ServiceName:checkout-servicebecomes "trace contains a span matching tuid, and a span matching ServiceName", not "one span matches both".This isn't new SQL shape for the codebase:
renderChartConfig.tsalready buildstuple(...) IN (SELECT \group` FROM ...)CTEs for series/group limiting (~lines 1619, 2190), and every trace-kind source already has a resolvabletraceIdExpression(packages/common-utils/src/types.ts:2261) to use as the correlation key. The rendering change would live alongsiderenderWhere()`, not inside the Lucene parser.Deliberately out of scope for the MVP: the raw where-bar text's top-level
AND(the issue's literal example syntax). Filter chips already give trace-scoping a clean per-clause boundary; the where-bar string doesn't -- telling a straightA AND Bchain apart fromA AND (B OR C)or a negated clause, and deciding what "trace-scoped" even means forOR/NOT, is real design work I'd rather not conflate with getting the mechanism landed. Could be a fast follow if the filter-chip version proves out.Questions before I put together a PR:
filtersLogicalOperator's AND/OR control, or a separate "search mode" concept?filtersplumbing this way?Happy to draft the PR once there's rough agreement on the above.
brandon-pereira commentedon Sep 18, 2026
@MikeShi42 @alex-fedotyev have you heard from others if this is requested by customers?
Also curious from OSS - if you think this would be helpful, please thumbs up the issue/this comment. Thanks!
fix(search): persist search scope and restore span-error retry (Click…
fix(search): keep Trace scope through history sync, saved searches an…
pulpdrew commentedon Dec 4, 2026
Just to echo some comments on #3154 - this is something we're looking to support in the future, using relational fields like
any.SpanName:GET AND root.Duration:>1000. It's also desirable in chart contexts to support grouping by these relational fields, which lends support to a self-join implementation rather than anTraceId IN (subquery)implementation.One current concern is performance on large data sets - TraceId IN (subquery)` and self-joins can be somewhat expensive when the condition matches large numbers of trace ids, so we may look at core database level improvements to make this performant.
A current workaround is to manually specify a
TraceId IN (subquery)pattern as a SQL WHERE condition on the search page or chart definition.