Skip to content

feat(traces): group the trace list by trace and hide single-span noise - #562

Merged
Makisuo merged 3 commits into
mainfrom
feat/trace-grouped-list
Aug 21, 2026
Merged

feat(traces): group the trace list by trace and hide single-span noise#562
Makisuo merged 3 commits into
mainfrom
feat/trace-grouped-list

Conversation

@Makisuo

@Makisuo Makisuo commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

What

The traces page listed entry-point spans, not traces: a trace crossing N services rendered N rows, spanCount was hardcoded to 1, and childless single-span roots (mobile ui.screen breadcrumbs, orphaned client spans, CLI self-flushes) drowned out real traffic — on a recent 1h window roughly 40% of rows were ≤2-span traces.

  • Grouped list is the new default. groupByTrace on the traces list QuerySpec routes to traceListQuery: one row per TraceId with the real span count, wall-clock duration, and every participating service. The per-page service-enrichment query is dropped in grouped mode (the aggregate computes services itself). rootOnly=false remains the legacy per-span list.
  • Noise filter, default on, never silent. Single-span traces whose root is not an entry-point kind (Server/Consumer) are dropped server-side; the footer reads e.g. “Showing 148 traces · 52 single-span noise traces hidden — show”, with the link and a sidebar toggle to opt out. minSpanCount is available as an extra param.
  • UI: new Spans column, screen.name suffix on mobile screen rows (so screen traces stop rendering as 40 identical ui.screen lines), duration sort kept.

Performance

  • Stage 2 of traceListQuery is now bounded to the window ±1h. Unbounded (the previous design), the PK analysis touches every retained partition and timed out (>10s) on prod at the default 12h window; bounded it returns comfortably. The pad keeps children that outlive the window (same ±1h convention as the trace-detail partition hint). The unit test and doc comment encode the rationale.
  • Stage 1 pages roots reading only three light columns; stage 2 aggregates just the paged 100 TraceIds via PK seeks. durationMs sort pages on the root span's duration so ordering stays decidable pre-aggregation.
  • Pagination pages by rows consumed, not rows kept. meta gains scannedCount/hiddenCount; hasNextPage keys off scannedCount === PAGE_SIZE and the offset advances by full pages, so a heavily filtered page can neither duplicate rows nor stall pagination. Domain offset cap raised 1000 → 2000 to match MAX_RETAINED_TRACES.

Reviewer notes

  • Dashboard list_traces widgets now receive grouped rows — same Trace shape, so no widget changes; the two test stubs were updated to the grouped row shape.
  • The facet sidebar (trace_list_mv, true roots) now agrees with the list's row population — previously the list used the wider entry-point predicate.
  • Two new SQL-catalog specs cover the grouped shapes (default + duration sort) in the ClickHouse DESCRIBE sweep; baseline regenerated.
  • Verified live against the dev org: first page 68 shown + 32 hidden, two pages 148 + 52 = 200 scanned, duration sort and the show/hide toggle behave, no duplicate rows across pages.

Follow-ups (not here): iOS SDK stops emitting ui.screen as standalone traces (session events instead), and an aggregate-first grouped view.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

The traces page listed entry-point spans, not traces: a trace crossing N
services rendered N rows, spanCount was hardcoded to 1, and childless
single-span roots (mobile ui.screen breadcrumbs, orphaned client spans,
CLI self-flushes) drowned out real traffic.

- Add groupByTrace to the traces list QuerySpec; the dispatch routes it
  to traceListQuery (one row per TraceId: real span count, wall-clock
  duration, all participating services) and skips the per-page service
  enrichment query, which the aggregate already computes.
- Bound traceListQuery stage 2 to the requested window padded by ±1h.
  Unbounded, the PK analysis touches every retained partition and times
  out on prod-sized retention (measured: 12h window >10s unbounded,
  well under bounded); the pad keeps children that outlive the window.
- Support durationMs sort in grouped mode (root-span duration drives
  paging; stage 2 returns the page in the same order).
- Web list defaults to grouped; rootOnly=false remains the legacy
  per-span list. A server-side noise filter drops single-span traces
  whose root is not an entry-point kind (Server/Consumer), default-on,
  with minSpanCount as an extra opt-in.
- Pagination pages by warehouse rows consumed, not rows kept: meta
  gains scannedCount/hiddenCount, hasNextPage keys off scannedCount,
  and the offset advances by full pages so a filtered page can neither
  duplicate rows nor stall. Domain offset cap raised to 2000 to match
  MAX_RETAINED_TRACES.
- UI: Spans column, screen.name suffix on mobile screen rows, sidebar
  'Hide Single-Span Noise' toggle, and a footer count with a 'show'
  link so hidden rows are never silently dropped.
- SQL catalog: two new grouped-list specs so the DESCRIBE sweep covers
  the new shapes; baseline regenerated.
…al spread

The effect-lint conditional-spread rule flags spreading a ternary object;
the schema key accepts a boolean, so send it directly.
…llow

The paging stage scanned raw traces, whose (OrgId, ServiceName, SpanName,
Timestamp) sort key cannot serve a time-ordered scan — an unfiltered
'newest 100 roots' read the whole window. trace_list_mv is roots-only and
sorted (OrgId, Timestamp, TraceId), so the same page is a read-in-order
index walk. Measured on prod, whole org, no filters: 12h 1285ms -> 928ms,
24h 3789-8358ms -> 1510ms.

Filters map onto the MV's pre-extracted columns (ServiceName, display
SpanName, StatusCode, Duration, DeploymentEnv, ServiceNamespace, and
HTTP method/status attribute filters via HttpMethod/HttpStatusCode);
anything the MV lacks (other attribute filters, resource attribute
filters, commitShas) falls back to the raw-traces stage unchanged. The
MV's second-granularity Timestamp means the ns keyset cursor is
truncated, with the (ts, traceId) tuple ordering keeping pages disjoint.

Matching MV SpanName also aligns the list with the facet sidebar, whose
values come from the same MV-normalized names.
@Makisuo
Makisuo merged commit 133f29f into main Aug 21, 2026
32 checks passed
@Makisuo
Makisuo deleted the feat/trace-grouped-list branch August 21, 2026 18:36
@Makisuo
Makisuo deployed to pr-preview August 21, 2026 18:36 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown

🍁 Maple PR preview

Note

Preview resources were removed when this pull request closed.

Final commit e6dfc76 · View workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant