feat(trace): add sentry trace logs subcommand (#247)#311
Draft
Conversation
Implements the `sentry trace logs` subcommand to view logs associated
with a distributed trace via the dedicated `/organizations/{org}/trace-logs/`
endpoint (org-scoped, queries all projects automatically).
- Adds TraceLog/TraceLogsResponse Zod schemas and types
- Adds `listTraceLogs()` to api-client using region-aware routing
- Adds trace-log formatters to log.ts (batch table + plain markdown)
- New command with flags: --json, --period/-t, --limit/-n, --query/-q, --web/-w
- Positional: `<trace-id>`, `<org> <trace-id>`, or `<org>/<trace-id>`
- 33 tests; 2394 passing total, 0 failures
Contributor
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛Api
Other
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Contributor
Codecov Results 📊✅ 2301 passed | Total: 2301 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
All tests are passing successfully. ✅ Patch coverage is 85.39%. Project has 3213 uncovered lines. Files with missing lines (3)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 80.05% 80.44% +0.39%
==========================================
Files 120 121 +1
Lines 16218 16429 +211
Branches 0 0 —
==========================================
+ Hits 12983 13216 +233
- Misses 3235 3213 -22
- Partials 0 0 —Generated by Codecov Action |
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 #247
Summary
Adds
sentry trace logs <trace-id>— a dedicated subcommand to view logs associated with a distributed trace.Uses the
/organizations/{org}/trace-logs/endpoint (org-scoped, queries all projects automatically), which is separate from the Explore/Events logs API and specifically designed for trace-correlated log retrieval.Usage
Implementation notes
statsPeriodrequired — the API returns empty results without it; defaults to14drenderTextTable/ plain markdown dual-mode pattern from feat(formatters): render all terminal output as markdown #297