fix(trace): show span IDs in trace view and fix event_id mapping#400
Merged
fix(trace): show span IDs in trace view and fix event_id mapping#400
Conversation
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Init
Issue List
Other
Bug Fixes 🐛Dsn
Init
Other
Documentation 📚
Internal Changes 🔧Init
Tests
Other
Other
🤖 This preview updates automatically when you update the PR. |
Contributor
Codecov Results 📊✅ 111 passed | Total: 111 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 1065 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 95.03% 95.03% —%
==========================================
Files 159 159 —
Lines 21431 21441 +10
Branches 0 0 —
==========================================
+ Hits 20366 20376 +10
- Misses 1065 1065 —
- Partials 0 0 —Generated by Codecov Action |
The trace detail API returns `event_id` instead of `span_id` on each span, so all span IDs rendered as `undefined` in the span tree and `span view` lookups always failed. Normalize the response in `getDetailedTrace` by copying `event_id` → `span_id`, and append the span ID to each tree line so users can copy it into `span view`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6dd9fc1 to
d1c32a9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Prevent rendering literal "undefined" when both span_id and event_id are absent on a span. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Export the function and add unit tests covering event_id→span_id fallback, existing span_id preservation, and child recursion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve conflict from api-client split (#405). Move normalizeTraceSpan and the getDetailedTrace normalization call into src/lib/api/traces.ts. Rename test file to kebab-case to satisfy lint. Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Summary
trace viewshowedundefinedfor every span ID in the tree because the trace detail API returnsevent_idinstead ofspan_id. This also brokespan viewlookups sincefindSpanByIdcompared against the missing field.Two fixes:
getDetailedTraceby copyingevent_id→span_idwhenspan_idis missingspan viewBefore:
After:
Test plan
bun run typecheckpassesbun run lintpassesbun test test/lib/formatters/span-tree.test.ts— 20 tests passtrace view <trace-id>shows real span IDsspan view <span-id> --trace <trace-id>finds the span🤖 Generated with Claude Code