feat(traces): group the trace list by trace and hide single-span noise - #562
Merged
Conversation
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.
🍁 Maple PR previewNote Preview resources were removed when this pull request closed. Final commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The traces page listed entry-point spans, not traces: a trace crossing N services rendered N rows,
spanCountwas hardcoded to1, and childless single-span roots (mobileui.screenbreadcrumbs, orphaned client spans, CLI self-flushes) drowned out real traffic — on a recent 1h window roughly 40% of rows were ≤2-span traces.groupByTraceon the traces list QuerySpec routes totraceListQuery: 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=falseremains the legacy per-span list.minSpanCountis available as an extra param.screen.namesuffix on mobile screen rows (so screen traces stop rendering as 40 identicalui.screenlines), duration sort kept.Performance
traceListQueryis 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.durationMssort pages on the root span's duration so ordering stays decidable pre-aggregation.metagainsscannedCount/hiddenCount;hasNextPagekeys offscannedCount === PAGE_SIZEand 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 matchMAX_RETAINED_TRACES.Reviewer notes
list_traceswidgets now receive grouped rows — sameTraceshape, so no widget changes; the two test stubs were updated to the grouped row shape.trace_list_mv, true roots) now agrees with the list's row population — previously the list used the wider entry-point predicate.Follow-ups (not here): iOS SDK stops emitting
ui.screenas standalone traces (session events instead), and an aggregate-first grouped view.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.