Skip to content

feat(web): make Sentry tracing and profiling opt-in - #1616

Merged
brendan-kellam merged 3 commits into
mainfrom
brendan/sentry-observability-flags-sou-2011
Aug 25, 2026
Merged

feat(web): make Sentry tracing and profiling opt-in#1616
brendan-kellam merged 3 commits into
mainfrom
brendan/sentry-observability-flags-sou-2011

Conversation

@brendan-kellam

@brendan-kellam brendan-kellam commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Fixes SOU-2011

Summary

  • make Sentry tracing opt-in for the Node and edge runtimes with SENTRY_TRACING_ENABLED=true
  • make Node profiling opt-in with SENTRY_PROFILING_ENABLED=true and require tracing to be enabled
  • document both environment variables in the development environment template

Testing

  • yarn workspace @sourcebot/web eslint src/sentry.server.config.ts src/sentry.edge.config.ts
  • yarn workspace @sourcebot/web build
  • git diff --check

Note

Low Risk
Observability toggles only; default behavior reduces tracing/profiling overhead with no change to error reporting when Sentry is configured.

Overview
Sentry performance tracing on the Node server and edge runtimes is now off unless SENTRY_TRACING_ENABLED=true. When tracing is disabled, tracesSampleRate is no longer passed to Sentry.init (previously it was always set with dev vs prod sampling).

Server-side profiling (nodeProfilingIntegration, session sampling, trace-linked lifecycle) is only registered when both tracing is enabled and SENTRY_PROFILING_ENABLED=true. Without those flags, Sentry still initializes for errors when DSN/env are set, but without trace or profile overhead.

.env.development documents the two new optional variables with defaults of "false".

Reviewed by Cursor Bugbot for commit 3f6bd63. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Improvements
    • Improved error monitoring configuration with separate controls for tracing and performance profiling.
    • Performance profiling now activates only when tracing is enabled, helping prevent unnecessary monitoring overhead.
    • Monitoring sampling can now be adjusted by environment, supporting more targeted diagnostics across development and production.
  • Configuration
    • Added optional development settings for enabling tracing and profiling when needed.

@github-actions

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ab9136d-2163-425a-9f94-812ec5847c04

📥 Commits

Reviewing files that changed from the base of the PR and between 7f7be84 and 3f6bd63.

📒 Files selected for processing (3)
  • .env.development
  • packages/web/src/sentry.edge.config.ts
  • packages/web/src/sentry.server.config.ts

Walkthrough

Sentry tracing now depends on SENTRY_TRACING_ENABLED. Server profiling also requires SENTRY_PROFILING_ENABLED. Development environment defaults document both flags as disabled.

Changes

Sentry telemetry configuration

Layer / File(s) Summary
Telemetry environment controls
.env.development, packages/web/src/sentry.server.config.ts
The development environment documents tracing and profiling flags. Server tracing and profiling options are configured conditionally. Profiling requires tracing.
Conditional edge initialization
packages/web/src/sentry.edge.config.ts
Edge tracing uses environment-specific sample rates only when SENTRY_TRACING_ENABLED is enabled.

Estimated code review effort: 2 (Simple) | ~10 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch brendan/sentry-observability-flags-sou-2011

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@brendan-kellam
brendan-kellam merged commit fb63ab8 into main Aug 25, 2026
11 of 12 checks passed
@brendan-kellam
brendan-kellam deleted the brendan/sentry-observability-flags-sou-2011 branch August 25, 2026 03:22
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