Skip to content

Feature: non-watch snapshot for sentry local (local dump / serve --once) #1035

Description

@sergical

Summary

sentry local is watch-only today: serve tails a live SSE stream and run wraps a process. There's no non-interactive way to grab the events captured so far and exit. A one-shot sentry local dump (or a --once flag on serve) would print the current buffer and return, which is handy for scripts, CI checks, and AI coding agents.

Motivation

The server already retains a buffer of recent envelopes for late subscribers, but the only way to read it is to attach to the stream and disconnect manually (serve -F json | head, or curl -N localhost:8969/stream). That's awkward for:

  • Agents/automation that want "what did my app emit in the last run?" as a single command with a clean exit code.
  • CI / scripts asserting on captured events without managing a long-lived process.
  • Quick inspection without entering watch mode.

(Related but distinct: #998 adds --verify — run app, wait for first envelope, pass/fail, exit — and #809 is synthetic event generation. Neither gives a snapshot of captured events.)

Proposed behavior

  • sentry local dump — connect to a running server (or the buffer), print everything currently buffered, then exit 0. Honors the existing -f/--filter (error|transaction|log|ai) and -F/--format (human|json) flags.
  • Or equivalently sentry local serve --once / --exit-after-drain: replay the buffer and exit instead of streaming.
  • Errors with a clear message if no server is running (or starts an ephemeral one for the run-style case — TBD).
# Snapshot the buffer as NDJSON and query it
sentry local dump -F json | jq 'select(.type=="error")'

# Just the AI/agent spans captured so far
sentry local dump -f ai

Notes / open questions

  • Scope is the in-memory Spotlight buffer (last N envelopes), not a persistent store — same data serve already replays to late subscribers.
  • Should dump auto-start a server if none is running, or only read an existing one? (Probably read-only; error if none.)
  • Naming: dump vs serve --once vs tail --once.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions