Open
Conversation
8a1be9f to
a27721f
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates Sentry from v9 to v10 and modernizes the instrumentation approach by using the recommended node --import pattern for ESM projects. The update enables several new features including Spotlight for local development, distributed tracing between frontend and backend, console logging integration, and automated Sentry release creation via GitHub Actions.
Key Changes
- Migrates Sentry packages from v9.32.0 to v10.31.0
- Implements early instrumentation using
--importflag in package.json scripts - Adds new
instrument.server.tsfile for centralized server-side Sentry configuration - Integrates Spotlight for local debugging and removes production-only Sentry initialization checks
- Enables distributed tracing with
Sentry.getMetaTagTransformer()for client-server trace correlation
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Updates Sentry packages to v10.31.0, adds @sentry/cli v3.0.1, and modifies scripts to use --import ./instrument.server.ts for early instrumentation |
| package-lock.json | Reflects dependency updates including Sentry v10 and updated OpenTelemetry instrumentation packages |
| instrument.server.ts | New file containing server-side Sentry initialization with Prisma, HTTP, profiling, and console logging integrations |
| vite.config.ts | Simplifies Sentry config by removing unstable_sentryVitePluginOptions and using new plugin configuration |
| server/index.ts | Removes manual Sentry initialization logic (moved to instrument.server.ts via --import) |
| server/utils/monitoring.ts | Deleted - functionality moved to instrument.server.ts |
| app/entry.server.tsx | Adds Sentry wrapper functions for request handling and error tracking, implements meta tag transformer for distributed tracing, and updates CSP for Spotlight |
| app/entry.client.tsx | Moves Sentry initialization inline with Spotlight support and updates integrations for v10 |
| app/utils/monitoring.client.tsx | Deleted - functionality moved to app/entry.client.tsx |
| .github/workflows/deploy.yml | Injects SENTRY_ENVIRONMENT and adds Sentry release creation step using getsentry/action-release@v3 |
| .env.example | Adds SENTRY_ENVIRONMENT variable for environment-specific configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
The environment variables are all over the place in this PR. |
faddb1c to
c511b01
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR updates Sentry, and I used the Sentry Wizard to configure the app for the latest best practices.
node --importattribute to instrument Sentry before the app starts, as recommended for ESM projects: https://docs.sentry.io/platforms/javascript/guides/node/install/esm/The SENTRY_ENVIRONMENT variable is passed to the production/staging fly app, so that you can filter for staging or production errors/traces in sentry. This variable is set to SENTRY_ENVIRONMENT=test in playwright. So that you can also debug sentry errors that occur in CI.
It adds Sentry.getMetaTagTransformer for distrubuted tracing between frontend and backend! 🔥
It enables spotlight in local development. In local development, errors are not send to Sentry server, but to the local Sentry spotlight app (if installed). This is useful for local debugging, but maybe even more important, this unlocks a lot of AI/MCP potential. If you install the Sentry MCP server, then this makes errors, network requests, db queries, logs, traces directly available to your agent.
I added the Sentry logging integration, as the epic stack has no logging solutions, and having logs next your error tool, can add a lot of context to why errors happened. And gives more context on what is actually going on the server:
Removed
unstable_sentryVitePluginOptionsas this is not needed anymore with the react router vite sentry plugin. It deletes sourcemaps automatically.I added a sentry example page (only available to admin users). So that users can easily test sentry errors in the deployed app.
Test Plan
I have tested all this locally and by deploying it myself.
Checklist
Screenshots