Skip to content

fix(observability): OTel is the only tracer; Sentry stays error-only - #55

Merged
agjs merged 1 commit into
mainfrom
chore/sentry-otel-coexistence
May 29, 2026
Merged

fix(observability): OTel is the only tracer; Sentry stays error-only#55
agjs merged 1 commit into
mainfrom
chore/sentry-otel-coexistence

Conversation

@agjs

@agjs agjs commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Default SENTRY_TRACES_SAMPLE_RATE=0 on the API and tracesSampleRate: 0 in the UI — OTel is now the single source of trace data shipped to Tempo.
  • @sentry/bun v10+ is built on @sentry/opentelemetry; running Sentry tracing alongside the OTel SDK double-instruments HTTP / fetch / ioredis. One tracer is the cleaner stance.
  • UI keeps browserTracingIntegration — at rate 0 it still writes the W3C traceparent header on /api/* fetches, which the API's OTel SDK reads to continue the trace server-side.
  • Error events keep trace_id from the shared OTel context on both sides, so the GlitchTip → Tempo pivot is preserved.
  • Comments in sentry.ts, schema.ts, .env.example, and the tracing / error-tracking docs spell out the trade-off and how to flip it back.

Test plan

  • apps/api: bun run validate — 997/999 green (2 pre-existing skips)
  • apps/ui: bun run validate — typecheck + lint + RTL + size-limit clean
  • apps/docs: bun run build — 67 pages, no broken links
  • Pre-push smoke gate green

Default Sentry tracesSampleRate to 0 on both API and UI.

@sentry/bun v10+ is built on @sentry/opentelemetry, so any non-zero
Sentry sample rate registers a second tracer alongside the OTel SDK in
config/otel/otel.ts and double-instruments HTTP / fetch / ioredis. The
stack already ships Tempo as the trace backend, so the cleaner stance
is one tracer, not two.

UI keeps browserTracingIntegration loaded — Sentry's browser SDK still
writes the W3C traceparent header on /api/* fetches with rate 0, which
is what the API's OTel SDK reads to continue the trace and ship spans
to Tempo. Error events on either side keep their trace_id from the
shared OTel context, so the GlitchTip → Tempo pivot still works.

Operator can flip SENTRY_TRACES_SAMPLE_RATE back to non-zero if they
want transactions in Sentry as well — comment in sentry.ts spells out
the trade-off.

Docs updated: tracing.mdx Browser→API FAQ explains the choice;
error-tracking.mdx points to tracing.mdx for the rationale.
@agjs
agjs enabled auto-merge (squash) May 29, 2026 16:52
@agjs
agjs merged commit 137c28b into main May 29, 2026
24 of 25 checks passed
@agjs
agjs deleted the chore/sentry-otel-coexistence branch May 29, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant