Skip to content

feat: add Sentry v2 structured storage, parser, and REST API#320

Merged
butschster merged 4 commits intomasterfrom
feat/sentry-v2-structured-storage
Mar 31, 2026
Merged

feat: add Sentry v2 structured storage, parser, and REST API#320
butschster merged 4 commits intomasterfrom
feat/sentry-v2-structured-storage

Conversation

@butschster
Copy link
Copy Markdown
Member

What

Full rework of the Sentry module: parse all envelope item types into typed SQLite tables, expose REST API for exceptions, traces, logs, and service map.

Why

Enable structured querying, fingerprint-based grouping, trace waterfall visualization, and service dependency mapping for Sentry data — instead of storing everything as a JSON blob.

How

  • 7 migration files creating sentry_error_events, sentry_exceptions, sentry_breadcrumbs, sentry_traces, sentry_transactions, sentry_spans, sentry_logs
  • Envelope parser routes items by type (event, transaction, spans, log) to dedicated storage functions
  • SHA256-based fingerprint grouping for exceptions
  • Span classifier extracts peer_type/peer_address from span attributes for service map
  • 7 REST endpoints under /api/sentry/ with pagination and filters
  • Transactions/spans/logs stored in structured tables only (no canonical feed events)
  • FRONTEND_DIR env var for serving frontend from disk during development

Testing

  • 47 Go tests covering storage, API endpoints, fingerprinting, span classification, envelope parsing
  • go test ./modules/sentry/... -timeout 30s — all pass
  • E2E tested against live server with real Sentry SDK data

Parse Sentry envelopes into typed tables (error events, exceptions,
breadcrumbs, traces, transactions, spans, logs) with fingerprint-based
grouping, span classification for service map, and 7 new REST endpoints.

Transactions and standalone spans/logs are stored in structured tables
only and do not create canonical feed events.

Adds FRONTEND_DIR env var to serve frontend from disk during development.
@butschster butschster added the enhancement New feature or request label Mar 31, 2026
When a request has an explicitly detected event type (e.g., sentry@host
in DSN), stop the pipeline after the matching handler — even if it
returns nil (no canonical event). HTTP dump catch-all now skips requests
with a detected type that belongs to another module.

Add pipeline integration tests verifying handler isolation for Sentry
events, transactions, logs, sessions, Inspector, and unknown POST.
@butschster butschster self-assigned this Mar 31, 2026
@butschster butschster moved this to Done in Buggregator Mar 31, 2026
Previously only SDK v3 was fully supported. This fixes three issues:

1. SDK v4 always uses envelope format and omits event_id from the item
   payload (only in envelope header). Events were invisible in the UI
   because the frontend couldn't find event_id in the payload. Fix:
   inject event_id from envelope header when missing.

2. SDK v2 sends timestamps as ISO 8601 strings ("2026-03-31T12:44:44Z")
   instead of numeric epoch. json.Number rejected these, causing the
   entire ErrorEvent unmarshal to fail silently — structured storage
   was skipped. Fix: FlexibleTS type accepts both formats.

3. SDK v3/v4 parameterized messages use object form
   {"message":"...", "params":[...], "formatted":"..."} which broke
   string unmarshal. Fix: FlexibleMessage type accepts both forms.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@butschster butschster linked an issue Mar 31, 2026 that may be closed by this pull request
@butschster butschster merged commit 9f62c20 into master Mar 31, 2026
1 check passed
@butschster butschster deleted the feat/sentry-v2-structured-storage branch March 31, 2026 17:06
@butschster butschster linked an issue Mar 31, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

v2.0 issues PHP Ray dumps show code instead of the formatted data Support for Sentry Logs? Add support for tracing using sentry sdk.

1 participant