From b24f1a03501e0f49a690a98998d7118da6040c21 Mon Sep 17 00:00:00 2001 From: Alex Fedotyev <61838744+alex-fedotyev@users.noreply.github.com> Date: Fri, 20 Nov 2026 06:06:50 +0000 Subject: [PATCH] feat(app): show materialized view acceleration on the trace search RED charts The Throughput, Errors and Duration tiles already read from a source's materialized views when one fits, but they hid the indicator dashboard tiles show, so there was no way to tell whether a tile was accelerated or why not. The tiles now show it; the date-range indicator stays off because the search range is exact. Co-Authored-By: Claude Opus 5.5 --- .changeset/trace-search-mv-indicator.md | 5 ++++ .../Search/TraceRedMetricsChart.tsx | 3 ++- .../__tests__/TraceRedMetricsChart.test.tsx | 11 ++++++++ .../e2e/features/materialized-views.spec.ts | 27 +++++++++++++++++++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .changeset/trace-search-mv-indicator.md diff --git a/.changeset/trace-search-mv-indicator.md b/.changeset/trace-search-mv-indicator.md new file mode 100644 index 0000000000..95745444a8 --- /dev/null +++ b/.changeset/trace-search-mv-indicator.md @@ -0,0 +1,5 @@ +--- +'@hyperdx/app': patch +--- + +feat: the trace search Throughput, Errors and Duration charts show whether a materialized view accelerated them, with the same indicator and explanation dialog dashboard tiles use diff --git a/packages/app/src/components/Search/TraceRedMetricsChart.tsx b/packages/app/src/components/Search/TraceRedMetricsChart.tsx index 457c5f5855..b24a178fe5 100644 --- a/packages/app/src/components/Search/TraceRedMetricsChart.tsx +++ b/packages/app/src/components/Search/TraceRedMetricsChart.tsx @@ -144,7 +144,8 @@ export function TraceRedMetricsChart({ sourceId: source.id, enabled: isReady, showDisplaySwitcher: false, - showMVOptimizationIndicator: false, + // Same acceleration indicator dashboard tiles show. The date-range one + // stays off: the search range is exact even when a view serves the tile. showDateRangeIndicator: false, queryKeyPrefix, onTimeRangeSelect, diff --git a/packages/app/src/components/Search/__tests__/TraceRedMetricsChart.test.tsx b/packages/app/src/components/Search/__tests__/TraceRedMetricsChart.test.tsx index a2b1a3a838..55e9d65cac 100644 --- a/packages/app/src/components/Search/__tests__/TraceRedMetricsChart.test.tsx +++ b/packages/app/src/components/Search/__tests__/TraceRedMetricsChart.test.tsx @@ -142,4 +142,15 @@ describe('TraceRedMetricsChart', () => { ), ).toEqual(new Set(['Duration'])); }); + + it('shows the acceleration indicator on every RED tile, without the date-range one', () => { + renderChart('red'); + + expect(mockTimeChartProps.length).toBeGreaterThan(0); + for (const props of mockTimeChartProps) { + // Left unset, DBTimeChart shows the indicator, as on dashboard tiles. + expect(props.showMVOptimizationIndicator).not.toBe(false); + expect(props.showDateRangeIndicator).toBe(false); + } + }); }); diff --git a/packages/app/tests/e2e/features/materialized-views.spec.ts b/packages/app/tests/e2e/features/materialized-views.spec.ts index 4ea83825ae..55fc8e1588 100644 --- a/packages/app/tests/e2e/features/materialized-views.spec.ts +++ b/packages/app/tests/e2e/features/materialized-views.spec.ts @@ -145,6 +145,33 @@ test.describe( await expect(aggTable).toContainText('count'); }); + test('trace search RED charts show that the view accelerated them', async ({ + page, + }) => { + const searchPage = new SearchPage(page); + const mvComponent = new MaterializedViewComponent(page); + + await searchPage.goto(); + await searchPage.selectSource(DEFAULT_TRACES_MV_SOURCE_NAME); + // One-minute buckets, the view's granularity. + await searchPage.timePicker.selectRelativeTime('Last 1 hour'); + + // Throughput, Errors and Duration each read the view: counts by status, + // the error ratio, and avg/p95/p99 of Duration are all pre-aggregated. + const indicators = mvComponent.getIndicator(); + await expect(indicators).toHaveCount(3, { timeout: 15000 }); + for (const indicator of await indicators.all()) { + await expect(indicator).toHaveAttribute('data-mv-accelerated', 'true', { + timeout: 15000, + }); + } + + // The dialog explains which view served the chart. + await indicators.first().click(); + await expect(mvComponent.getModal()).toBeVisible({ timeout: 10000 }); + await expect(mvComponent.getModalItem(E2E_TRACES_MV_TABLE)).toBeVisible(); + }); + test( 'Configuring an MV with auto-population in the source form', { tag: '@sources' },