Skip to content

Commit f7933f0

Browse files
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

11 files changed

+1701
-215
lines changed

AGENTS.md

Lines changed: 8 additions & 71 deletions
Large diffs are not rendered by default.

plugins/sentry-cli/skills/sentry-cli/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ List logs from a project
504504
- `-n, --limit <value> - Number of log entries (1-1000) - (default: "100")`
505505
- `-q, --query <value> - Filter query (Sentry search syntax)`
506506
- `-f, --follow <value> - Stream logs (optionally specify poll interval in seconds)`
507+
- `--trace <value> - Filter logs by trace ID (32-character hex string)`
507508
- `--json - Output as JSON`
508509

509510
**Examples:**
@@ -687,6 +688,7 @@ List logs from a project
687688
- `-n, --limit <value> - Number of log entries (1-1000) - (default: "100")`
688689
- `-q, --query <value> - Filter query (Sentry search syntax)`
689690
- `-f, --follow <value> - Stream logs (optionally specify poll interval in seconds)`
691+
- `--trace <value> - Filter logs by trace ID (32-character hex string)`
690692
- `--json - Output as JSON`
691693

692694
### Traces

0 commit comments

Comments
 (0)