Issue: Sentry SDK interferes with OpenTelemetry fetch spans in Node.js even with skipOpenTelemetrySetup: true
When initializing Sentry SDK alongside OpenTelemetry instrumentation, Nextjs fetch spans stop being generated, despite:
- Setting
skipOpenTelemetrySetup: truein Sentry configuration - Properly configuring OpenTelemetry auto-instrumentations
- Loading OpenTelemetry before Sentry initialization
- Node.js: v22.17.1
- Next.js: 15.5.2
- @sentry/nextjs: ^10.11.0
- @opentelemetry/auto-instrumentations-node: ^0.63.0
- OS: macOS Darwin 24.6.0
-
Clone this repository
-
Install dependencies:
npm install
-
Start the local observability stack (OpenTelemetry Collector + Tempo + Grafana):
npm run observability:up
This will start:
- OpenTelemetry Collector (ports 4317/4318)
- Tempo (trace storage)
- Grafana (http://localhost:3003)
Note: First login to Grafana requires username:
adminand password:admin
- Ensure
SENTRY_DSNis not set in.env - Start the server:
npm run dev
- Open http://localhost:3000
- Check traces in Grafana at http://localhost:3003/explore (tempo as source). Pre-configured url for traces search.
- Result: OpenTelemetry spans are generated and visible grafana. Fetch spans are present.
- Set
SENTRY_DSNin.envfile:SENTRY_DSN=your-sentry-dsn-here - Restart the server:
npm run dev
- Click "Make Fetch Request" button
- Check traces in Grafana at http://localhost:3003/explore (tempo as source). Pre-configured url for traces search.
- Result: OpenTelemetry spans are generated and visible grafana. Fetch spans are not present.
- Uses
@opentelemetry/auto-instrumentations-nodewith HTTP instrumentation enabled - Properly configured before Sentry initialization
Sentry.init({
dsn: process.env.SENTRY_DSN,
skipOpenTelemetrySetup: true, // Should prevent interference
integrations: [Sentry.httpIntegration({spans: false})],
});- OpenTelemetry SDK initializes first (
instrumentation.node.ts) - Sentry initializes conditionally based on
SENTRY_DSNenvironment variable
OpenTelemetry Nextjs fetch instrumentation should continue generating spans when Sentry is enabled with skipOpenTelemetrySetup: true.
Fetch spans disappear completely when Sentry SDK is initialized, regardless of the skipOpenTelemetrySetup setting.
{
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/auto-instrumentations-node": "^0.63.0",
"@opentelemetry/context-async-hooks": "^2.1.0",
"@opentelemetry/exporter-trace-otlp-grpc": "^0.204.0",
"@opentelemetry/sdk-node": "^0.204.0",
"@sentry/nextjs": "^10.11.0",
"next": "15.5.2"
}To stop the observability stack:
npm run observability:downAfter running tests, view traces in Grafana:
- Basic exploration: http://localhost:3003/explore
- Pre-configured trace search: url
This minimal reproduction case demonstrates the conflict between Sentry and OpenTelemetry instrumentation that prevents proper observability setup.