feat(query): OR groups in where-clauses - #1193
Conversation
The where-clause parser dropped `(a OR b)` with a warning, so any filter that needed one ran wider than written. The dependency drilldowns were the visible case: an edge named after its messaging or rpc system also holds spans whose destination is literally that name, and the drill could only reach half. Grammar: one level of parentheses holding attribute clauses joined by OR, AND-ed with the rest. AND or nesting inside a group is rejected rather than guessing precedence, and the splitters no longer cut inside parentheses. - parseWhereClause returns groups only to callers that pass `orGroups: true`; everyone else keeps the old warning, so no consumer drops a group silently. - AttributeFilter gains optional `or` alternatives on the same map. buildAttrFilterCondition ORs the members, each under its semconv aliases, and skips the index prefilters for a group. The trace-list MV route and the facet opts leave groups to the raw path. - Dashboards, alerts and MCP query_data (query-builder model) apply groups on traces and logs, and warn on metrics. Members go through the normal clause handler, so a named key like service.name or a span/resource mix is rejected with a warning. formatFiltersAsWhereClause prints groups back. - Traces page: the URL, API input and chips carry groups; a group chip reads "Any of (a OR b)". - Dependency drills use a group for edges named after their system, so they match both halves of the edge. - MCP dashboard docs describe the new grammar.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (18)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Note A newer push replaced |
…nto feat/where-clause-or-groups
Maple review🟡 Confidence 3/5 · needs attention Adds one-level
Findings🟠 Warning · F1 ·
|
The query builder parsed every source with orGroups, but only traces and logs lower groups, so a product-events widget dropped an OR group silently and counted every event. Parse with groups only for traces and logs; every other source gets the parser's "unsupported clause" warning, which also replaces the metrics-specific one and covers any source added later.
Maple review🟢 Confidence 4/5 · likely safe to merge The builder now opts into OR groups only for the two sources that lower them (
What was checked
|
Stacked on #1190. Closes #1192.
Why
The where-clause parser dropped
(a OR b)groups with only a warning, so any filter that needed an OR ran wider than written. That affects saved dashboards, alerts, the MCPquery_datatool and the traces page. The dependency drilldowns were the visible case: an edge named after its messaging or RPC system also holds spans whose destination is literally that name, and the drilldown could only reach half of them.Grammar
One level of parentheses, holding attribute clauses joined by
ORand AND-ed with the rest:service.nameorhttp.methodcan't be OR-ed. Those groups are dropped with a warning.ANDor nesting inside a group is rejected rather than guessing precedence.ANDinside parentheses, and(a = 1)parses as a plain clause.How it works
where-clause.ts): returnsgroupsonly to callers that passorGroups: true. Every other caller keeps today's "unsupported clause" warning, so no consumer starts dropping a group silently. The logs list widget and the performance hints stay on the old behavior.AttributeFiltergains an optionalorlist of alternatives on the same map. It's an additive schema change, so every place that passes filter arrays through is unchanged.buildAttrFilterCondition): ORs the members, each under its own semconv aliases. Index prefilters are skipped for a group, because an OR of per-member candidates isn't narrower than the exact OR.query_data):formatFiltersAsWhereClauseprints groups back out.Testing
and/orinside values,(a) AND (b), rejection of AND or nesting inside a group, and the default without opt-in.toWhereClauseround trip, and the group chip with its removal.src/lib, services and traces (923), backend dashboards (84) and aisrc/mcp/lib(308). The SQL baseline is unchanged.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit