feat(stats): add Sentry observability with distributed tracing #2530
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements Sentry error tracking and distributed tracing for stats-web, matching the deploy-web setup. The
traceparentheader is now propagated for all requests (SSR and client-side).Changes
Core Sentry Setup
@sentry/nextjsv9.37.0 dependencysentry.client.config.tsfor browser-side initialization with browser extension/third-party error filteringinstrumentation.tsto initialize Sentry on server runtimenext.config.jsto integrate Sentry webpack plugin for source maps and release trackingpino-prettyfrom client bundle to resolve webpack errorsDistributed Tracing
ErrorHandlerServicewithsentryTraceToW3C()converter (Sentry trace format → W3C traceparent)serverFetch()to injecttraceparentandbaggageheaders from Sentry trace context/api/and/_next/routesError Capture
error.tsxandglobal-error.tsxto capture exceptions viaSentry.captureException()Environment Configuration
.env.sample,.env.production,.env.staging,.env.local.sample)NEXT_PUBLIC_SENTRY_DSN,NEXT_PUBLIC_SENTRY_APPLICATION_KEY,NEXT_PUBLIC_SENTRY_ENABLEDExample: Distributed Tracing
Requires Sentry project creation and credential configuration for activation.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.