Repository navigation
Conversation
The trace list took `max(service)` (alphabetically last service in the trace) as the trace's service and the earliest span's name as its root, so multi-service traces were attributed to whichever service sorts last, and clock skew between hosts could pick a non-root span as "root". Order by "is parentless" first, then start time, for both service and root_name (and the root-name filter), falling back to the earliest span when the root hasn't arrived. Closes thejefflarson#272 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`?service=X` filtered spans before GROUP BY, so root name, duration, span count and error count were computed over X's spans only: focusing the gateway hid downstream errors from `errors_only`, focusing a leaf service showed its own span as the "root" with its own duration. Select traces that contain a span of X via a subquery (served by spans_service_start_idx), like the attribute filter already does, and keep aggregating over all of the trace's spans. Closes thejefflarson#273 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #272. Closes #273.
Two independent bugs in
query_traces, one commit each (they touch adjacent lines of the same SQL, so separate PRs would just conflict). Repro trace + script: #272 (comment)1. Label each trace by its root span (#272)
max(service)picked the alphabetically-last service in the trace, androot_namewas the earliest span. Both now come from the parentless span, falling back to the earliest span for a partial trace:The
name(root span) filter inHAVINGuses the same expression.2. Service filter keeps the whole trace (#273)
WHERE service = $1dropped the other services' spans beforeGROUP BY, so root/duration/span count/error count described a fragment. It's now atrace_id IN (SELECT … WHERE service = $1 AND <same window>)subquery — same shape as the existingattrfilter — and the aggregates run over the whole trace, as the comment above the query already promised.The subquery is served by
spans_service_start_idx:Tests
trace_list_labels_trace_by_its_root_span— 3-service trace with the root in the alphabetically-first service and a clock-skewed leaf span that starts before the root; partial trace with no root → earliest span; name filter matches the root. Onmain:left: "demo-c-pay", right: "demo-a-gateway".trace_list_service_filter_keeps_whole_trace— focusing either end of the chain returns the identical whole-trace row;errors_only+ gateway focus finds the downstream error; unrelated service still excluded. Onmain:demo-a-gateway: span_count left: 2, right: 4.cargo fmt --check,cargo clippy --all-targets -D warnings,cargo test(same unrelated local-onlyrollup_vacuum_health_canary_…caveat as feat(logs): filter by minimum severity #269/fix(api): attribute filter matches typed (number/bool) values #271).🤖 Generated with Claude Code