Commit 224e6dc
authored
fix(trace): show span IDs in trace view and fix event_id mapping (#400)
## Summary
`trace view` showed `undefined` for every span ID in the tree because
the trace detail API returns `event_id` instead of `span_id`. This also
broke `span view` lookups since `findSpanById` compared against the
missing field.
Two fixes:
- Normalize the API response in `getDetailedTrace` by copying `event_id`
→ `span_id` when `span_id` is missing
- Append the span ID (dimmed) to each span tree line so users can copy
it into `span view`
Before:
```
├─ http.client — GET /api/users (52ms) undefined
```
After:
```
├─ http.client — GET /api/users (52ms) a6ff0caaa87dd118
```
## Test plan
- [x] `bun run typecheck` passes
- [x] `bun run lint` passes
- [x] `bun test test/lib/formatters/span-tree.test.ts` — 20 tests pass
- [x] Manual: `trace view <trace-id>` shows real span IDs
- [x] Manual: `span view <span-id> --trace <trace-id>` finds the span1 parent 0671cfa commit 224e6dc
File tree
4 files changed
+51
-1
lines changed- src/lib
- api
- formatters
- test/lib
4 files changed
+51
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
52 | 69 | | |
53 | 70 | | |
54 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1122 | 1122 | | |
1123 | 1123 | | |
1124 | 1124 | | |
| 1125 | + | |
| 1126 | + | |
1125 | 1127 | | |
1126 | 1128 | | |
1127 | 1129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
0 commit comments