Repository navigation
feat(app): show RED metrics on the trace search results view - #3183
alex-fedotyev wants to merge 10 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 78a275e 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 |
|
Deep Review✅ No critical issues found. The RED-metrics view is built from well-factored pure builders ( 🟡 P2 — recommended
🔵 P3 nitpicks (1)
Reviewers (12): correctness, testing, maintainability, project-standards, agent-native, learnings-researcher, performance, reliability, adversarial, previous-comments, kieran-typescript, frontend-races. Testing gaps:
Note: No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
| if (mode === 'rate') { | ||
| return { | ||
| ...base, | ||
| select: [ |
There was a problem hiding this comment.
🔵 minor — Error-rate count + countIf + post-aggregation ratio + hidden helper series is a fourth copy of an existing pattern
The repo's REQUIRED DRY rule asks for a grep on the operation before adding a helper. This exact trio already exists at ServicesDashboardPage/HttpTab.tsx:221-239 (requestErrorRateConfig: total_requests / error_requests / error_rate, ERROR_RATE_PERCENTAGE_NUMBER_FORMAT) with its matching hiddenSeries={['total_requests','error_requests']} at HttpTab.tsx:419, again inside the CTE at HttpTab.tsx:282-298, and again at llm/dashboard/OverviewCharts.tsx:152-166. Extract one builder — e.g. errorRateSelect(errorCondition, { totalAlias, errorAlias, rateAlias }) returning the select trio plus its hidden-series list — into a shared module and have all four call sites use it, rather than adding a fourth independently-aliased copy whose helper names must be kept in sync with a separate ERROR_RATE_HELPER_SERIES constant by hand.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
The shape is shared, agreed, but extracting a builder would touch HttpTab, OverviewCharts and the service-dashboard side panels, which widens this PR beyond its own files. Tracking it as a follow-up rather than folding it in here.
PR Review
1 finding(s): 🔴 0 P0/P1 · 🟡 0 P2 · 🔵 1 P3 No inline comments. 1 P3 folded at the bottom. 🔵 1 P3 — no action needed before merge
Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
7c3a45a to
108e06a
Compare
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
E2E Test Results✅ All tests passed • 473 passed • 1 skipped • 1452s
Tests ran across 4 shards in parallel. |
108e06a to
3c58c91
Compare
3c58c91 to
2c78a82
Compare
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
3865961 to
9e004bb
Compare
9e004bb to
1a96fd6
Compare
Trace search showed a single count histogram above the results. For trace sources with a duration column it now shows Throughput, Errors and Duration side by side, under a shared sync scope so hovering one moves the cursor on all three. Each chart is built from the same base config the histogram uses, in a pure module so the aggregations can be unit tested without rendering. Every aggregation is over a raw column so materialized views can satisfy it; the error ratio and the duration unit are applied at display instead. Logs and other sources keep the existing histogram.
- Fall back to the single histogram on a compact (mobile) viewport instead of three unreadable side-by-side tiles. - Compute a numeric capped y-axis domain for the rate tile so it dedupes tick labels and no longer collapses to [0, 0] when the sole series is selected; the cap now applies on the selection and fit paths too. - Drop the unreachable 0/0 guard on the error-rate column; a returned GROUP BY bucket always has total_spans >= 1, so divide directly the way HttpTab does. - Rename the Duration percentile series p95/p99 to P95/P99 to match the app's acronym casing. - Strengthen the volume-mode test so it catches dropped sidebar filters, and add computeYAxisBounds coverage for the capped axis.
- Throughput now renders the status-grouped count histogram this view replaces, under the results-count query-key prefix, so react-query runs a single shared scan instead of a second ungrouped count() on every search and live-tail tick. This also restores the per-status drill-down the histogram offered. - Duration series pin their colors through each select item's `color` rather than a name-keyed seriesColors prop, so there is one source of truth for per-series color. Drops the DBTimeChart seriesColors prop, the DURATION_SERIES_COLORS map, and the alias/color lockstep test; setLineColors reads the color off the select item by result-column name.
…ant duration format - When a trace source has a custom group-by selected, fall back to the single histogram (which honors arbitrary group-by) instead of the RED tiles, whose grouping is fixed (Throughput and Errors by status, Duration ungrouped). The group-by selector now has a coherent effect rather than silently regrouping only part of the view. - Drop the hand-computed duration numberFormat: DBTimeChart already infers it via useChartNumberFormats -> getTraceDurationNumberFormat, because each duration series aggregates the source's duration expression. Removes the getTraceDurationNumberFormat memo and durationConfig's numberFormat parameter.
- Compact x-axis ticks use the responsive axis tick font size instead of a hardcoded 11px, matching the non-compact ticks and honoring the user's content font scale. - Correct the yAxisMaxDomain prop doc: the cap applies on every path (selection and fit included), not only the default path.
…ries
Group-by none resolves to no grouping, which collapses Throughput to a
single count() series; with the legend on, that surfaced the raw aggregate
expression ("count()") as the series label. Show the Throughput legend only
when the view is grouped (the status-code default), where it names each
status, matching how the histogram gated its own legend. The ungrouped case
keeps just the "Throughput" title.
Reading select[].color in every DBTimeChart changed saved dashboard tiles. The field is only set through the table editor, and other display types ignore it, so a tile switched from Table to Line took on its column colors, and every group of a grouped series shared one color. - DBTimeChart applies select-item colors only with applySelectColors, which the trace RED duration tile sets. Every other chart keeps the positional palette. - Derive the colors in getSelectSeriesColors, which resolves each token the way the table and number tiles do: a legacy token maps to its hue, and an unknown one falls back to the palette instead of failing the chart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The compact tick renderer hardcoded var(--color-text-muted), while the y-axis and regular x-axis ticks use the fill Recharts passes in, so the RED tiles showed their x and y labels in different colors. Use the passed-in fill. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The grouped check re-implemented isUsingGroupBy from common-utils. Its extra whitespace branch could never run, since the search group-by is already trimmed before it reaches the chart config. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test relies on seriesHi taking the first palette slot and said that came from its higher peak. Colors follow the sorted series order, which falls back to the series key when log-level order ties, so that is why seriesHi comes first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1a96fd6 to
78a275e
Compare
Stack
Layer 1 of 2 in a GitHub stack (stack #3688). GitHub shows each layer's base as the branch below it, but the stack's base is
main: merging any PR lands it and every PR below it onmain, one squashed commit each. Each PR's diff is only its own layer, and CI runs as if each targetsmain:Summary
Trace search shows a single count histogram above the results. For trace sources that expose a duration column, this replaces it with RED metrics:
countIf(error) / count(), rendered as a percent line) and volume (countIf(error), bars, grouped by status).durationPrecision.Every aggregation is over a raw column (
count,countIf,quantile/avgof the duration expression), so AggregatingMergeTree materialized views can satisfy the queries; the ratio and the unit conversion happen at the display layer or in a post-aggregation column.The three charts are
DBTimeCharts under a shared sync scope, so hovering one shows a synced cursor on all three at the same timestamp, and each renders as a dashboard-tile card. Clicking a status series on the Throughput or Errors-volume chart filters the results, which is the drill-down the histogram offered. Logs and other sources keep the existing histogram, as do trace sources on a compact (narrow/mobile) viewport, where three side-by-side tiles would not fit.The per-chart aggregations for Errors and Duration live in a small pure module,
traceRedMetrics.ts, built from the same base config the histogram uses, so they honor the active WHERE filter and time range and can be unit tested without rendering.Three supporting props on shared chart components, each with its only consumer in this PR:
yAxisMaxDomain, so the Errors rate tile caps at 100% instead of auto-scaling a near-zero series to a nonsense range. The cap is a numeric domain, so the axis keeps clean, de-duplicated tick labels and never collapses to a single point.compactXAxisLabels, so the edge time labels do not clip on tiles this narrow. The labels keep the axis color the y-axis labels use.applySelectColors, so the Duration tile can pin its percentile colors (below) without changing how any other chart colors its series.The Duration percentiles are pinned to cool hues (Avg blue, P95 cyan, P99 purple) so latency never borrows the red the Errors line uses, and each percentile keeps its color across sessions regardless of how the data sorts the lines. The colors are set on each series' select-item
color(the schema's existing per-series color field), so there is a single source of truth and no separate color map to keep in sync.DBTimeChartonly reads them when the caller passesapplySelectColors: saved tiles only setcolorthrough the table editor, so their line and bar charts keep the positional palette, and grouped series never collapse to one color. Tokens resolve the way the table and number tiles resolve them, so a legacy token maps to its hue and an unknown one falls back to the palette instead of failing the chart.The Errors and Duration tiles are auxiliary to the results query, so they run under their own query namespace: that keeps the slow quantile scan out of the reported search latency, while live tail still waits on them before advancing the window, so a tick cannot stack a second set of chart queries on the first. Throughput shares the results-count query instead, so it adds no extra scan.
Screenshots
Light theme:
Dark theme:
Test plan
traceRedMetrics.test.ts) and the chart color pipeline (ChartUtils.test.ts), including that a select-item color overrides the positional palette and does not consume a positional slot, and thatgetSelectSeriesColorskeys colors by alias, maps a legacy token to its hue, and skips unknown tokens and unaliased items.chart-redslot. Because the color now lives on the select item, it cannot drift from the series it colors.computeYAxisBoundscoverage for the capped rate axis: a flat/zero series shows[0, cap]with clean ticks, the cap holds under selection (no[0, 0]collapse) and over reference lines, and is skipped for stacked charts.tsc --noEmit,eslintwith no new warnings, and knip. CI covers the full suite and the productionbuild:clickhousebundle.Notes
minorchangeset.mainnow that fix(app): count legacy STATUS_CODE_ERROR spans as errors #3181 (the shared error-span predicate) has merged, so the diff is just the RED-metrics files. The Errors tile useserrorStatusPredicateSqlfrom@hyperdx/common-utils, which fix(app): count legacy STATUS_CODE_ERROR spans as errors #3181 landed.