Skip to content

feat(trace-view): expose span attributes in trace and span views#742

Merged
BYK merged 2 commits intomainfrom
feat/span-attributes-trace-view
Apr 13, 2026
Merged

feat(trace-view): expose span attributes in trace and span views#742
BYK merged 2 commits intomainfrom
feat/span-attributes-trace-view

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 13, 2026

Summary

Closes #736

  • Add --full flag to trace view that fetches full span attributes via the per-span trace-items detail endpoint
  • Auto-enabled in --json mode so JSON consumers (agents, scripts) get complete data without needing to discover the flag
  • Extract shared attributesToDict and fetchMultiSpanDetails helpers from span/view.ts into api/traces.ts for reuse
  • No artificial cap — fetches details for ALL spans with concurrency 15; progress on stderr for large traces
  • Merge data dicts onto each span in JSON output, consistent with existing span view --json shape

Behavior

Command Fetches details? Notes
trace view <id> No Fast, no extra API calls
trace view <id> --json Yes (auto) Progress on stderr
trace view <id> --full Yes (explicit) Human output notes count
trace view <id> --full --json Yes Same as --json alone

Test plan

  • Property-based tests for flattenSpanTree (count, membership, empty)
  • Unit tests for --json auto-enable, --full flag, detail skipping in human mode
  • Unit tests for JSON output including data dict with filtered attributes
  • All existing trace/span tests pass (251 tests across 9 files)

Add --full flag to `trace view` that fetches full span attributes via
the per-span trace-items detail endpoint. Auto-enabled in --json mode
so JSON consumers (agents, scripts) get complete data by default.

- Extract shared `attributesToDict` and `fetchMultiSpanDetails` from
  span/view.ts into api/traces.ts for reuse across both commands
- Fetch details for ALL spans (no cap) with concurrency 15; progress
  on stderr for >20 spans, informational warning for >500 spans
- Merge `data` dicts onto each span in JSON output (consistent with
  existing span view --json shape)
- Human output notes detail count; hint suggests --full or --json
- Property-based tests for flattenSpanTree; unit tests for --full
  and --json auto-enable behavior
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (cli) Add sentry cli defaults command for persistent settings by BYK in #721
  • (docs) Auto-generate driftable documentation sections by BYK in #739
  • (issue-list) Add search syntax docs, case-insensitive AND/OR, and JSON syntax reference by BYK in #738
  • (trace-view) Expose span attributes in trace and span views by BYK in #742

Bug Fixes 🐛

Init

  • Treat no-op edits as passthrough instead of throwing by betegon in #731
  • Remove JSON minification that breaks edit-based codemods by betegon in #719

Resolve

  • Address review comments and add tests for fuzzy project recovery by BYK in #732
  • Fuzzy auto-recovery for project slug resolution by BYK in #728

Upgrade

  • Detect npm install method from node_modules path by BYK in #723
  • Add shell option on Windows for .cmd package managers by BYK in #722

Other

  • (ci) Add retry logic to ORAS/bsdiff downloads and upgrade ORAS by BYK in #741
  • (dashboard) Remove overly restrictive dataset-display cross-validation by BYK in #720
  • (errors) Improve ContextError wording for auto-detect failures by BYK in #726
  • (issue) Support share issue URLs by BYK in #718
  • (issue-list) Auto-correct AND and reject OR in --query to prevent 400 by BYK in #727
  • (telemetry) Rename isClientApiError to isUserApiError and exclude 400 by BYK in #729
  • Bug fixes from Sentry error monitoring (CLI-FR, CLI-RN) + auth default by BYK in #740

Internal Changes 🔧

  • Regenerate skill files by github-actions[bot] in ca16b2ff

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-742/

Built to branch gh-pages at 2026-04-13 22:31 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

Codecov Results 📊

134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 99.40%. Project has 1629 uncovered lines.
✅ Project coverage is 95.28%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/lib/api/traces.ts 97.44% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    95.28%    95.28%        —%
==========================================
  Files          234       234         —
  Lines        34443     34546      +103
  Branches         0         0         —
==========================================
+ Hits         32820     32917       +97
- Misses        1623      1629        +6
- Partials         0         0         —

Generated by Codecov Action

…utable

- Replace spread with Array.from() per codebase convention
- Add /trace-items/ to the immutable cache tier (24h TTL) since span
  attributes never change once ingested, same rationale as events and
  trace detail endpoints
@BYK BYK marked this pull request as ready for review April 13, 2026 22:38
@BYK BYK merged commit 93cc403 into main Apr 13, 2026
26 checks passed
@BYK BYK deleted the feat/span-attributes-trace-view branch April 13, 2026 22:50
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.

feat: expose span attributes/data in trace and span views

1 participant