Repository navigation
Closed
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
^10.11.0
Framework Version
Next 15.5.2
Link to Sentry event
No response
Reproduction Example/SDK Setup
Sentry.init({
dsn: sentryDSN,
environment: environment,
release: release,
skipOpenTelemetrySetup: true,
integrations: [
Sentry.httpIntegration({spans: false}),
],
});
Along with:
context.setGlobalContextManager(new AsyncLocalStorageContextManager());
const traceExporter = new OTLPTraceExporter();
const batchSpanProcessor = new SimpleSpanProcessor(traceExporter);
const sdk = new NodeSDK({
spanProcessors: [batchSpanProcessor],
textMapPropagator: new W3CTraceContextPropagator(),
instrumentations: [
getNodeAutoInstrumentations({
'@opentelemetry/instrumentation-http': {
enabled: true
},
'@opentelemetry/instrumentation-dns': {
enabled: false
}
}),
],
});
// Start the OpenTelemetry SDK
sdk.start();
// Ensure proper shutdown on process exit
process.on('SIGTERM', () => {
sdk
.shutdown()
.then(() => console.log('OpenTelemetry SDK shut down successfully'))
.catch((error: Error) => console.error('Error shutting down OpenTelemetry SDK:', error))
.finally(() => process.exit(0));
});
Initialised in nextjs as follows:
export const register = async () => {
if (process.env.NEXT_RUNTIME === 'nodejs') {
await import('../instrumentation.node');
await import('../sentry.server.config');
}
};
export const onRequestError = Sentry.captureRequestError;
Steps to Reproduce
Complete reproduction repository: https://github.com/JandaTheMan/Sentry-OpenTelemetry-Issue-Reproduction
Setup reproduction environment:
- Clone the reproduction repository above
- Install dependencies: npm install
- Start observability stack: npm run observability:up
Test without Sentry (baseline): - Ensure SENTRY_DSN is NOT set in .env
- Start app: npm run dev
- Visit http://localhost:3000/
- Check traces in Grafana at http://localhost:3003/explore
Test with Sentry (issue reproduction): - Set SENTRY_DSN=your-dsn-here in .env file
- Restart app: npm run dev
- Visit http://localhost:3000/
- Check traces in Grafana at http://localhost:3003/explore
Note: The repository includes a complete observability stack (OpenTelemetry Collector + Tempo + Grafana) and detailed instructions for easy reproduction.
A complete guide for reproduction is included in the repository.
Expected Result
Fetch node traces are included the same way when sentry sdk is not initialised:
Actual Result
Fetch node traces are not included the same way when sentry sdk is not initialised:
Reacted by Matthew Read
Metadata
Metadata
Assignees
Projects
- StatusShow more project fieldsNo status
Activity
linear commentedon Sep 10, 2025
JS-919 Sentry SDK interferes with OpenTelemetry fetch spans despite skipOpenTelemetrySetup: true
JandaTheMan commentedon Sep 10, 2025
The documentation states:
If tracing is disabled, the Node Fetch instrumentation will not emit any spans. In this scenario, it will only inject sentry-specific trace propagation headers. You are free to add your own Node Fetch instrumentation on top of this which may emit spans as you like.If this is the expected behaviour the documentation is not fully clear.
s1gr1d commentedon Sep 11, 2025
Hello, thanks for writing in! While we guard for that in the Node SDK, we probably have some places in the Next.js SDK where we modify/drop spans without checking for
hasSpansEnabledorskipOpenTelemetrySetup. We'll take a look at this.fix(nextjs): Enable fetch span when OTel setup is skipped (#17699)
github-actions commentedon Sep 22, 2025
A PR closing this issue has just been released 🚀
This issue was referenced by PR #17699, which was included in the 10.13.0 release.