Commit f7933f0
feat(log-list): add --trace flag to filter logs by trace ID (#329)
Add `--trace` flag to `sentry log list` that scopes the query to a
specific trace ID.
When `--trace` is given, the command uses the dedicated trace-logs
endpoint (`/organizations/{org}/trace-logs/`) instead of the
project-scoped events endpoint, since the Explore/Events logs API does
not support trace ID filtering in query syntax. This means only org
resolution is needed — the positional target is treated as an org slug,
not an org/project pair.
### Changes
- `--trace` flag with 32-char hex validation on `sentry log list`
- Works in both single-fetch and `--follow` streaming modes
- Trace follow mode polls the trace-logs endpoint and deduplicates by
`timestamp_precise`
- Refactored `writeLogs()` to accept both `SentryLog` and `TraceLog` via
shared `LogLike` type
- Trace-logs mock route + 5 E2E tests
### Usage
```bash
sentry log list --trace abc123def456abc123def456abc123de
sentry log list myorg --trace abc123def456abc123def456abc123de
sentry log list myorg --trace abc123def456abc123def456abc123de -f
sentry log list myorg --trace abc123def456abc123def456abc123de --json
```
Closes #317
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>1 parent 6d7a2bc commit f7933f0
File tree
11 files changed
+1701
-215
lines changed- plugins/sentry-cli/skills/sentry-cli
- src
- commands
- log
- trace
- lib
- formatters
- test
- commands
- log
- trace
- e2e
- lib
- mocks
11 files changed
+1701
-215
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
504 | 504 | | |
505 | 505 | | |
506 | 506 | | |
| 507 | + | |
507 | 508 | | |
508 | 509 | | |
509 | 510 | | |
| |||
687 | 688 | | |
688 | 689 | | |
689 | 690 | | |
| 691 | + | |
690 | 692 | | |
691 | 693 | | |
692 | 694 | | |
| |||
0 commit comments