Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/metrics-ch-side-merge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperdx/common-utils': patch
'@hyperdx/app': patch
---

Multi-series metric charts now run as a single composed ClickHouse query instead of one query per series joined client-side. The per-series queries are combined via UNION ALL and pivoted back into one row per (group, time bucket) in SQL, including ratio charts (`seriesReturnType: 'ratio'`) and both `ratioMode` variants, which previously divided the two result sets in the browser/node. Result shape, column naming (including same-alias `__{index}` disambiguation), gap semantics, and ratio semantics are unchanged; charts with many series render with fewer round trips, and "View SQL" for multi-series metric charts now shows the full query instead of only the first series.
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,12 @@ export function ChartEditorControls({
)}
{/* Grouped ratios divide per-group by default; this opts into
share-of-total (each group's contribution to the blended
rate). Only metric sources fan out to per-series queries
merged client-side (see mergeResultSets/ratioMode) — other
sources compute the ratio within-group in the DB, where
ratioMode has no effect — so restrict to metric sources. No
effect on ungrouped ratios either, so also gate on a Group
By. */}
rate). Only metric sources render the ratio over composed
per-series branches where ratioMode applies (see
renderMultiSeriesMetricChartConfig) — other sources compute
the ratio within-group via divide(), where ratioMode has no
effect — so restrict to metric sources. No effect on
ungrouped ratios either, so also gate on a Group By. */}
{fields.length === 2 &&
seriesReturnType === 'ratio' &&
tableSource?.kind === SourceKind.Metric &&
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ dashboard**:
(`convertToTimeChartConfig` / `convertToNumberChartConfig` /
`convertToTableChartConfig` / `convertToCategoricalChartConfig`).
2. `shared/tileQuery.ts` executes it via `clickhouseClient.queryChartConfig()`
from common-utils — internally
`setChartSelectsAlias → splitChartConfigs → renderChartConfig`, identical to
from common-utils — internally `setChartSelectsAlias → renderChartConfig`
(one composed statement, even for multi-series metric charts), identical to
the web's `useQueriedChartConfig` core (minus chunking / MV optimization /
PromQL).
3. `shared/chartData.ts` shapes the response (ports of
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/shared/tileQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ export async function fetchTileData({
});

// Same call the web frontend's useQueriedChartConfig makes —
// internally: setChartSelectsAlias → splitChartConfigs →
// renderChartConfig → query → join metric result sets.
// internally: setChartSelectsAlias → renderChartConfig → query (one
// composed statement, even for multi-series metric charts).
const data = await clickhouseClient.queryChartConfig({
config: queriedConfig,
metadata,
Expand Down

Large diffs are not rendered by default.

Loading
Loading