Files
arbpulse_github/openspec/changes/gate-sentry-spans/tasks.md
T
Mauricio Barragan a5c83ee026 feat(observability): gate Sentry tracing spans behind SENTRY_TRACING
Spans are now created and exported to Sentry only when SENTRY_TRACING is enabled (default off), keeping 24/7 operation within the free-tier span quota. Error monitoring stays always-on. Includes OpenSpec change gate-sentry-spans (proposal, design, specs, tasks).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-16 12:54:15 -06:00

911 B

1. Tracing gate

  • 1.1 Add isTracingEnabled() helper (reads SENTRY_TRACING, truthy = "1"/"true" case-insensitive) exported from the instrumentation layer
  • 1.2 In src/instrumentation/otel.ts, return the no-op tracer unless both SENTRY_DSN and SENTRY_TRACING are truthy (keep withSpan signature and its Sentry.captureException in catch)
  • 1.3 In src/instrumentation/sentry.ts, only set tracesSampleRate when tracing is enabled (omit it otherwise)

2. Documentation

  • 2.1 Add SENTRY_TRACING (default false) to .env.example with a note it gates spans for free-tier safety
  • 2.2 Update the README observability section to describe the flag and default-off behavior

3. Verification

  • 3.1 npm run typecheck passes
  • 3.2 npm test passes
  • 3.3 Manually confirm: with SENTRY_TRACING unset, no spans are emitted; error capture path unaffected