diff --git a/.changeset/trace-search-mv-indicator.md b/.changeset/trace-search-mv-indicator.md new file mode 100644 index 000000000..95745444a --- /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 457c5f585..b24a178fe 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 a2b1a3a83..55e9d65ca 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 4ea83825a..55fc8e158 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' },