Repository navigation
Conversation
A builder chart keeps each series' filter in its own aggCondition, not in the statement-level where, so a drill-down built from chart-level state alone spans every series and its counts don't reconcile with the clicked line. Resolve the clicked series from the result column it was plotted from (value columns map positionally onto select) and AND its aggCondition onto the search. A whole-bucket click, a merged ratio column, or a formula column falls back to the union of every series' condition, which is the scan scope the chart used. Co-authored-by: Mike Shi <mike@hyperdx.io>
🦋 Changeset detectedLatest commit: 2ce2db9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
[Medium impact] Fixes drill-down search to include the clicked series' filter. The mixed-language search issue from the previous review still needs fixing before merge.
|
| return aggConditionScopeFilter( | ||
| clickedSeries != null ? [clickedSeries] : select, | ||
| ); |
There was a problem hiding this comment.
When a whole-bucket, ratio, or formula action falls back to all series and those series use different condition languages, aggConditionScopeFilter returns undefined, so the Search URL drops every series condition. The chart query still renders each condition in its own language and ORs them together. The resulting search is therefore broader than the chart, and its results will not reconcile with the chart.
There was a problem hiding this comment.
Accurate, but not something this PR introduced or can fix here. On main every drill-down drops all series conditions, so this case is no worse than before. The per-series Search is unaffected: a single clicked series has one language.
The search URL can't express the OR: it carries one where language and ANDs its filters. Turning Lucene into SQL needs async column metadata, and adding an OR mode to the search page's filters would also change how its sidebar filters combine. So the fallback leaves the search unscoped (a superset of the chart's rows) rather than scoped wrongly. I documented that in resolveSeriesConditionFilter and added tests for both the mixed-language fallback and a clicked series in a mixed-language chart (2ce2db9).
There was a problem hiding this comment.
Agreed. The mixed-language whole-bucket fallback is a pre-existing limitation of the search URL/filter model, and this change preserves the existing unscoped behavior when the union cannot be represented. The per-series path remains correctly scoped because it resolves a single condition and therefore a single filter language. The documentation and tests cover this tradeoff, so no change is needed for this PR.
E2E Test Results✅ All tests passed • 323 passed • 1 skipped • 1046s
Tests ran across 4 shards in parallel. |
…casting Keeps the app 'as any' ratchet at its baseline. Co-authored-by: Mike Shi <mike@hyperdx.io>
…-search-series-where-9e86 # Conflicts: # packages/app/src/components/__tests__/DBTimeChart.test.tsx Co-authored-by: Mike Shi <mike@hyperdx.io>
The search URL ANDs its filters and carries a single where language, so it cannot OR a SQL series condition with a Lucene one; the union fallback leaves the search unscoped in that case. Pin that, and that a clicked series in such a chart still resolves to its own condition, with tests. Co-authored-by: Mike Shi <mike@hyperdx.io>
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
Why
On a chart with several series, each series carries its own WHERE. Clicking a line and picking Search opened a search that ignored that series' condition, so the results spanned every series and the numbers didn't reconcile with the chart. (HDX-5441)
The cause: a builder chart doesn't put a series' filter in the statement-level
where— the editor clears it and each series keeps its filter inaggCondition, applied inside that series' aggregate.buildEventsSearchUrlonly ever read chart-level state, plus one narrow special case (promote the condition of a lone series intowherewhen the chart has nowhereof its own). Every other shape silently dropped it.What changed
buildEventsSearchUrltakes aseriesConditionfilter and ANDs it onto the search. The existing single-series promotion still wins where it applies, so those URLs are unchanged; the condition is no longer dropped when promotion can't happen (several series, or a chart-levelwhereto AND with).resolveSeriesConditionFilter(inDBTimeChart) picks the clicked series' condition. Value columns map positionally ontoselect— the contractuseChartNumberFormatsalready relies on — so the result column the series was plotted from names itsselectentry. The pinned tooltip now hands that column name tobuildSearchUrlrather than only the series key, which also covers the single-value-column + group-by shape where the key carries no column name.aggConditionScopeFilter. That is exactly the scan scope the chart used, and it yields nothing once any series is unfiltered (the chart reads every row anyway). This is what fixes the sibling "View all events" action the issue asked about.Focus is untouched: it applies group-column filters, and a series distinguished only by its WHERE has no group column to focus on.
Testing
Unit tests (
make ci-unitgreen across all packages,make ci-lintclean):resolveSeriesConditionFilter: clicked series, whole-bucket union, unfiltered series, ratio, formula-with-hidden-operands, formula column, raw SQL select.buildEventsSearchUrl: multi-series condition applied, ANDed with chartwhere+ filters, not duplicated when promoted, kept when promotion is impossible.ChartSeriesTooltip: the clicked series' value column reachesbuildSearchUrl.Manual, against the dev stack with seeded logs (
foo6/min,bar2/min,baz1/min) on a two-series tile — series AServiceName:"foo", series BServiceName:"bar":main)filters=[], 18 rows, foo + bar + bazfilters=[{"type":"lucene","condition":"ServiceName:\"foo\""}], 12 rows, foo onlyfilters=[], 18 rows, foo + bar + bazfilters=[{"type":"lucene","condition":"ServiceName:\"bar\""}], 4 rows, bar onlyfilters=[], 18 rows, foo + bar + bazfilters=[{"type":"lucene","condition":"(ServiceName:\"foo\") OR (ServiceName:\"bar\")"}], 16 rows, foo + bar, no bazBefore — Search on the "foo count" series returns foo, bar and baz:
After — the same click is scoped to
ServiceName:"foo":After — "View all events" carries the union of both series, so
baz(not on the chart) stays out:Linear Issue: HDX-5441