From 5911d7e93c7248edb4261784442fcabd59266d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yusufhan=20Sa=C3=A7ak?= Date: Wed, 2 Sep 2026 21:59:53 +0300 Subject: [PATCH 1/5] fix(deno): Gate tracing integrations on hasSpansEnabled Node and Bun both skip getTracingIntegrations() when tracing is disabled; the Deno SDK spread them unconditionally, so 22 tracing integrations were added and eagerly subscribed with tracing off. init() also no longer writes the computed default set back onto the caller's options object: the set is now tracing-dependent, so caching it there would pin the first init's result for a reused object. Local computation matches how the Node SDK handles the same step. Test updates: default-integration assertions across the Deno suites now init with tracing enabled, since that is the condition under which tracing integrations are defaults at all; mod.test.ts snapshots lose the 22 tracing names (the bug made visible in the event payload); new tests pin both directions of the gate, the public getDefaultIntegrations() behaviour, and the no-mutation contract. Fixes #23893 --- .../suites/direct-client-acs/scenario.mjs | 2 +- .../suites/orchestrion-amqplib/test.ts | 6 +- .../suites/orchestrion-anthropic/test.ts | 6 +- .../suites/orchestrion-aws/test.ts | 6 +- .../suites/orchestrion-firebase/test.ts | 6 +- .../suites/orchestrion-generic-pool/test.ts | 6 +- .../suites/orchestrion-google-genai/test.ts | 6 +- .../suites/orchestrion-graphql/test.ts | 6 +- .../suites/orchestrion-kafkajs/test.ts | 6 +- .../suites/orchestrion-langchain/test.ts | 6 +- .../suites/orchestrion-langgraph/test.ts | 6 +- .../suites/orchestrion-lru-memoizer/test.ts | 6 +- .../suites/orchestrion-mongo/test.ts | 6 +- .../suites/orchestrion-mongoose/test.ts | 6 +- .../suites/orchestrion-mysql/test.ts | 6 +- .../suites/orchestrion-mysql2/test.ts | 6 +- .../suites/orchestrion-openai/test.ts | 6 +- .../suites/orchestrion-postgres/test.ts | 6 +- .../suites/orchestrion-postgresjs/test.ts | 6 +- .../suites/orchestrion-tedious/test.ts | 6 +- .../suites/orchestrion-vercel-ai/test.ts | 6 +- packages/deno/src/sdk.ts | 15 +++-- .../deno/test/__snapshots__/mod.test.ts.snap | 66 ------------------- packages/deno/test/deno-redis.test.ts | 8 ++- packages/deno/test/sdk.test.ts | 40 ++++++++++- 25 files changed, 155 insertions(+), 96 deletions(-) diff --git a/dev-packages/deno-integration-tests/suites/direct-client-acs/scenario.mjs b/dev-packages/deno-integration-tests/suites/direct-client-acs/scenario.mjs index 31ad355c989e..1dc48ebb60c2 100644 --- a/dev-packages/deno-integration-tests/suites/direct-client-acs/scenario.mjs +++ b/dev-packages/deno-integration-tests/suites/direct-client-acs/scenario.mjs @@ -18,7 +18,7 @@ const client = new DenoClient({ dsn: 'https://username@domain/123', tracesSampleRate: 1, traceLifecycle: 'static', - integrations: getDefaultIntegrations({}), + integrations: getDefaultIntegrations({ tracesSampleRate: 1 }), stackParser: createStackParser(nodeStackLineParser()), beforeSendTransaction(event) { const spans = event.spans ?? []; diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-amqplib/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-amqplib/test.ts index d1131ccbad36..d059cb76971c 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-amqplib/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-amqplib/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('amqplib instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('Amqplib'), `Amqplib should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-anthropic/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-anthropic/test.ts index 900458bb9672..9372fd70934f 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-anthropic/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-anthropic/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('anthropic instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('Anthropic_AI'), `Anthropic_AI should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-aws/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-aws/test.ts index c899e579e4e8..b07fb3da9b31 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-aws/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-aws/test.ts @@ -12,7 +12,11 @@ import { SENTRY_OP } from '@sentry/conventions/attributes'; Deno.test('aws-sdk instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('Aws'), `Aws should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-firebase/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-firebase/test.ts index 584cea379d88..6d4d3e6ff87a 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-firebase/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-firebase/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('firebase instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('Firebase'), `Firebase should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-generic-pool/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-generic-pool/test.ts index bca94240c65e..2f5258935c00 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-generic-pool/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-generic-pool/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('generic-pool instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('GenericPool'), `GenericPool should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-google-genai/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-google-genai/test.ts index db7451c570bb..db193197e0f5 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-google-genai/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-google-genai/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('google-genai instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('Google_GenAI'), `Google_GenAI should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-graphql/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-graphql/test.ts index bf1ab8a88b59..a352bd20b79d 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-graphql/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-graphql/test.ts @@ -48,7 +48,11 @@ async function assertParseSpan(channelName: string): Promise { Deno.test('graphql instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('Graphql'), `Graphql should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-kafkajs/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-kafkajs/test.ts index 0f3eab7ecf8d..d94839209bd1 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-kafkajs/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-kafkajs/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('kafkajs instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('Kafka'), `Kafka should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-langchain/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-langchain/test.ts index efbfa6a5035d..26d5da42cb0f 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-langchain/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-langchain/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('langchain instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('LangChain'), `LangChain should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-langgraph/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-langgraph/test.ts index ec4d010110f4..e1045407beb5 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-langgraph/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-langgraph/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('langgraph instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('LangGraph'), `LangGraph should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-lru-memoizer/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-lru-memoizer/test.ts index 7c591293280f..acff0649c8a7 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-lru-memoizer/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-lru-memoizer/test.ts @@ -11,7 +11,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('lru-memoizer instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('LruMemoizer'), `LruMemoizer should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-mongo/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-mongo/test.ts index c289a1120eef..f9693fc07ef9 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-mongo/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-mongo/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('mongodb instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('Mongo'), `Mongo should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-mongoose/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-mongoose/test.ts index 09c08d4d8efc..46854c29b07a 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-mongoose/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-mongoose/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('mongoose instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('Mongoose'), `Mongoose should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-mysql/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-mysql/test.ts index c21638cf667a..83b7ba15ad81 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-mysql/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-mysql/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('mysql instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('Mysql'), `Mysql should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-mysql2/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-mysql2/test.ts index afafeb6ea7f8..3e2e2f84ce71 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-mysql2/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-mysql2/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('mysql2 instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('Mysql2'), `Mysql2 should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-openai/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-openai/test.ts index c47726c24473..2d1c47b2e30b 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-openai/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-openai/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('openai instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('OpenAI'), `OpenAI should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-postgres/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-postgres/test.ts index 2e7ca65e4d69..55631d7c9c0e 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-postgres/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-postgres/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('pg instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('Postgres'), `Postgres should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-postgresjs/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-postgresjs/test.ts index 7def5567c022..640e51733173 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-postgresjs/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-postgresjs/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('postgres.js instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('PostgresJs'), `PostgresJs should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-tedious/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-tedious/test.ts index 9cb6c45468bc..c3d9b6bca478 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-tedious/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-tedious/test.ts @@ -11,7 +11,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('tedious instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ traceLifecycle: 'static', dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + traceLifecycle: 'static', + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('Tedious'), `Tedious should be in defaults, got ${names.join(', ')}`); }); diff --git a/dev-packages/deno-integration-tests/suites/orchestrion-vercel-ai/test.ts b/dev-packages/deno-integration-tests/suites/orchestrion-vercel-ai/test.ts index 642020b26075..8c7cc42b5fc2 100644 --- a/dev-packages/deno-integration-tests/suites/orchestrion-vercel-ai/test.ts +++ b/dev-packages/deno-integration-tests/suites/orchestrion-vercel-ai/test.ts @@ -10,7 +10,11 @@ import { resetGlobals, transactionSink, withTimeout } from '../../src/index.ts'; Deno.test('vercel-ai instrumentation: included in default integrations (Deno 2.8.0+)', () => { resetGlobals(); - const client = init({ dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + traceLifecycle: 'static', + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('VercelAI'), `VercelAI should be in defaults, got ${names.join(', ')}`); }); diff --git a/packages/deno/src/sdk.ts b/packages/deno/src/sdk.ts index 07d5e8366184..4b4b74090452 100644 --- a/packages/deno/src/sdk.ts +++ b/packages/deno/src/sdk.ts @@ -6,6 +6,7 @@ import { eventFiltersIntegration, functionToStringIntegration, getIntegrationsToSetup, + hasSpansEnabled, initAndBind, linkedErrorsIntegration, requestDataIntegration, @@ -26,7 +27,7 @@ import { makeFetchTransport } from './transports'; import type { DenoOptions } from './types'; /** Get the default integrations for the Deno SDK. */ -export function getDefaultIntegrations(_options: Options): Integration[] { +export function getDefaultIntegrations(options: Options): Integration[] { // We return a copy of the defaultIntegrations here to avoid mutating this return [ // Common @@ -45,7 +46,7 @@ export function getDefaultIntegrations(_options: Options): Integration[] { globalHandlersIntegration(), // server-utils integrations ...getErrorIntegrations(), - ...getTracingIntegrations(), + ...(hasSpansEnabled(options) ? getTracingIntegrations() : []), ]; } @@ -96,14 +97,16 @@ const defaultStackParser: StackParser = createStackParser(nodeStackLineParser()) * @see {@link DenoOptions} for documentation on configuration options. */ export function init(options: DenoOptions = {}): Client { - if (options.defaultIntegrations === undefined) { - options.defaultIntegrations = getDefaultIntegrations(options); - } + // Computed into a local rather than written back onto `options`: the default set now + // depends on the tracing options, so caching it on the caller's object would pin the + // result of the first `init` for any reused options object. + const defaultIntegrations = options.defaultIntegrations ?? getDefaultIntegrations(options); const clientOptions: ServerRuntimeClientOptions = { ...options, + defaultIntegrations, stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser), - integrations: getIntegrationsToSetup(options), + integrations: getIntegrationsToSetup({ ...options, defaultIntegrations }), transport: options.transport || makeFetchTransport, }; diff --git a/packages/deno/test/__snapshots__/mod.test.ts.snap b/packages/deno/test/__snapshots__/mod.test.ts.snap index 4ce1aea47cd0..0a94a93ed604 100644 --- a/packages/deno/test/__snapshots__/mod.test.ts.snap +++ b/packages/deno/test/__snapshots__/mod.test.ts.snap @@ -63,28 +63,6 @@ snapshot[`captureMessage 1`] = ` "Fastify", "Hapi", "Koa", - "Graphql", - "Mongo", - "Mongoose", - "Mysql", - "Mysql2", - "Redis", - "Postgres", - "Prisma", - "Tedious", - "GenericPool", - "Kafka", - "Amqplib", - "LruMemoizer", - "Aws", - "LangChain", - "LangGraph", - "VercelAI", - "OpenAI", - "Anthropic_AI", - "Google_GenAI", - "PostgresJs", - "Firebase", ], name: "sentry.javascript.deno", packages: [ @@ -170,28 +148,6 @@ snapshot[`captureMessage twice 1`] = ` "Fastify", "Hapi", "Koa", - "Graphql", - "Mongo", - "Mongoose", - "Mysql", - "Mysql2", - "Redis", - "Postgres", - "Prisma", - "Tedious", - "GenericPool", - "Kafka", - "Amqplib", - "LruMemoizer", - "Aws", - "LangChain", - "LangGraph", - "VercelAI", - "OpenAI", - "Anthropic_AI", - "Google_GenAI", - "PostgresJs", - "Firebase", ], name: "sentry.javascript.deno", packages: [ @@ -284,28 +240,6 @@ snapshot[`captureMessage twice 2`] = ` "Fastify", "Hapi", "Koa", - "Graphql", - "Mongo", - "Mongoose", - "Mysql", - "Mysql2", - "Redis", - "Postgres", - "Prisma", - "Tedious", - "GenericPool", - "Kafka", - "Amqplib", - "LruMemoizer", - "Aws", - "LangChain", - "LangGraph", - "VercelAI", - "OpenAI", - "Anthropic_AI", - "Google_GenAI", - "PostgresJs", - "Firebase", ], name: "sentry.javascript.deno", packages: [ diff --git a/packages/deno/test/deno-redis.test.ts b/packages/deno/test/deno-redis.test.ts index ae5bccafc1e2..6643f0dba020 100644 --- a/packages/deno/test/deno-redis.test.ts +++ b/packages/deno/test/deno-redis.test.ts @@ -52,9 +52,13 @@ function withTimeout(p: Promise, ms: number, what: string): Promise { }); } -Deno.test('redisIntegration: included in default integrations', () => { +Deno.test('redisIntegration: included in default integrations when tracing is enabled', () => { resetGlobals(); - const client = init({ dsn: 'https://username@domain/123' }) as DenoClient; + const client = init({ + dsn: 'https://username@domain/123', + tracesSampleRate: 1, + traceLifecycle: 'static', + }) as DenoClient; const names = client.getOptions().integrations.map(i => i.name); assert(names.includes('Redis'), `Redis should be in defaults, got ${names.join(', ')}`); }); diff --git a/packages/deno/test/sdk.test.ts b/packages/deno/test/sdk.test.ts index 5d0d8973a075..0dc8ae06ed0a 100644 --- a/packages/deno/test/sdk.test.ts +++ b/packages/deno/test/sdk.test.ts @@ -1,6 +1,6 @@ import { assertNotEquals } from 'https://deno.land/std@0.202.0/assert/assert_not_equals.ts'; import { assertArrayIncludes } from 'https://deno.land/std@0.212.0/assert/assert_array_includes.ts'; -import { init, spanStreamingIntegration } from '../build/esm/index.js'; +import { getDefaultIntegrations, init, spanStreamingIntegration } from '../build/esm/index.js'; import { assert } from 'https://deno.land/std@0.212.0/assert/assert.ts'; import { assertEquals } from 'https://deno.land/std@0.212.0/assert/assert_equals.ts'; @@ -32,3 +32,41 @@ Deno.test("doesn't add spanStreamingIntegration if user added it manually", () = assertEquals(integrations.length, 1); assert(!integrations[0].isDefaultInstance); }); + +Deno.test("doesn't add tracing integrations when tracing is disabled", () => { + const client = init({}); + const names = client.getOptions().integrations.map(i => i.name); + assert(!names.includes('Graphql')); + assert(!names.includes('Postgres')); + assert(!names.includes('OpenAI')); +}); + +Deno.test('adds tracing integrations when tracing is enabled', () => { + const client = init({ tracesSampleRate: 1, traceLifecycle: 'static' }); + const names = client.getOptions().integrations.map(i => i.name); + assertArrayIncludes(names, ['Graphql', 'Postgres', 'OpenAI']); +}); + +Deno.test('error integrations stay in place when tracing is disabled', () => { + const client = init({}); + const names = client.getOptions().integrations.map(i => i.name); + assertArrayIncludes(names, ['Express', 'Fastify']); +}); + +// getDefaultIntegrations is public API, so the gate keys off the options the caller +// passes to it, not the ones a client was initialised with. +Deno.test('getDefaultIntegrations gates the tracing set on the options it is given', () => { + const withTracing = getDefaultIntegrations({ tracesSampleRate: 1 }).map(i => i.name); + assertArrayIncludes(withTracing, ['Graphql', 'Postgres', 'OpenAI']); + const withoutTracing = getDefaultIntegrations({}).map(i => i.name); + assert(!withoutTracing.includes('Graphql')); +}); + +Deno.test("init doesn't write the computed default integrations back onto the options object", () => { + const options = { dsn: 'https://username@domain/123' }; + init(options); + assertEquals('defaultIntegrations' in options, false); + const second = init({ ...options, tracesSampleRate: 1, traceLifecycle: 'static' }); + const names = second.getOptions().integrations.map(i => i.name); + assertArrayIncludes(names, ['Graphql']); +}); From 38b41d48e583bf498dedeaee2e6e4de944ee570c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yusufhan=20Sa=C3=A7ak?= Date: Wed, 9 Sep 2026 12:32:42 +0300 Subject: [PATCH 2/5] fix(deno): drop the explicit defaultIntegrations property and refresh the snapshot ClientOptions no longer carries defaultIntegrations on develop, so the object literal failed the type check after the merge. The local still feeds getIntegrationsToSetup. The snapshot loses the tracing integrations, which is what the gate is for. --- packages/deno/src/sdk.ts | 1 - .../deno/test/__snapshots__/mod.test.ts.snap | 69 ------------------- 2 files changed, 70 deletions(-) diff --git a/packages/deno/src/sdk.ts b/packages/deno/src/sdk.ts index 4b4b74090452..7ac7674fcd8d 100644 --- a/packages/deno/src/sdk.ts +++ b/packages/deno/src/sdk.ts @@ -104,7 +104,6 @@ export function init(options: DenoOptions = {}): Client { const clientOptions: ServerRuntimeClientOptions = { ...options, - defaultIntegrations, stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser), integrations: getIntegrationsToSetup({ ...options, defaultIntegrations }), transport: options.transport || makeFetchTransport, diff --git a/packages/deno/test/__snapshots__/mod.test.ts.snap b/packages/deno/test/__snapshots__/mod.test.ts.snap index 9c0b54cd65da..0a94a93ed604 100644 --- a/packages/deno/test/__snapshots__/mod.test.ts.snap +++ b/packages/deno/test/__snapshots__/mod.test.ts.snap @@ -63,29 +63,6 @@ snapshot[`captureMessage 1`] = ` "Fastify", "Hapi", "Koa", - "Graphql", - "Mongo", - "Mongoose", - "Mysql", - "Mysql2", - "Redis", - "Postgres", - "Prisma", - "Tedious", - "GenericPool", - "Kafka", - "Amqplib", - "LruMemoizer", - "Aws", - "LangChain", - "LangGraph", - "Mastra", - "VercelAI", - "OpenAI", - "Anthropic_AI", - "Google_GenAI", - "PostgresJs", - "Firebase", ], name: "sentry.javascript.deno", packages: [ @@ -171,29 +148,6 @@ snapshot[`captureMessage twice 1`] = ` "Fastify", "Hapi", "Koa", - "Graphql", - "Mongo", - "Mongoose", - "Mysql", - "Mysql2", - "Redis", - "Postgres", - "Prisma", - "Tedious", - "GenericPool", - "Kafka", - "Amqplib", - "LruMemoizer", - "Aws", - "LangChain", - "LangGraph", - "Mastra", - "VercelAI", - "OpenAI", - "Anthropic_AI", - "Google_GenAI", - "PostgresJs", - "Firebase", ], name: "sentry.javascript.deno", packages: [ @@ -286,29 +240,6 @@ snapshot[`captureMessage twice 2`] = ` "Fastify", "Hapi", "Koa", - "Graphql", - "Mongo", - "Mongoose", - "Mysql", - "Mysql2", - "Redis", - "Postgres", - "Prisma", - "Tedious", - "GenericPool", - "Kafka", - "Amqplib", - "LruMemoizer", - "Aws", - "LangChain", - "LangGraph", - "Mastra", - "VercelAI", - "OpenAI", - "Anthropic_AI", - "Google_GenAI", - "PostgresJs", - "Firebase", ], name: "sentry.javascript.deno", packages: [ From d39551003734247ca6c445d98b39483619772f5a Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 9 Sep 2026 08:32:27 -0700 Subject: [PATCH 3/5] Apply batched suggestions from code review Co-authored-by: isaacs --- packages/deno/src/sdk.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/deno/src/sdk.ts b/packages/deno/src/sdk.ts index 7ac7674fcd8d..d08274b3dc44 100644 --- a/packages/deno/src/sdk.ts +++ b/packages/deno/src/sdk.ts @@ -97,7 +97,7 @@ const defaultStackParser: StackParser = createStackParser(nodeStackLineParser()) * @see {@link DenoOptions} for documentation on configuration options. */ export function init(options: DenoOptions = {}): Client { - // Computed into a local rather than written back onto `options`: the default set now + // Computed into a local rather than written back onto `options`: the default set // depends on the tracing options, so caching it on the caller's object would pin the // result of the first `init` for any reused options object. const defaultIntegrations = options.defaultIntegrations ?? getDefaultIntegrations(options); @@ -105,7 +105,7 @@ export function init(options: DenoOptions = {}): Client { const clientOptions: ServerRuntimeClientOptions = { ...options, stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser), - integrations: getIntegrationsToSetup({ ...options, defaultIntegrations }), + integrations: getIntegrationsToSetup({ integrations: options.integrations, defaultIntegrations }), transport: options.transport || makeFetchTransport, }; From f00351660a4f71159626f964d3f5ca627933ddc8 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 9 Sep 2026 08:34:07 -0700 Subject: [PATCH 4/5] Update packages/deno/test/sdk.test.ts --- packages/deno/test/sdk.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/deno/test/sdk.test.ts b/packages/deno/test/sdk.test.ts index 0dc8ae06ed0a..ad7152cb21ba 100644 --- a/packages/deno/test/sdk.test.ts +++ b/packages/deno/test/sdk.test.ts @@ -66,7 +66,8 @@ Deno.test("init doesn't write the computed default integrations back onto the op const options = { dsn: 'https://username@domain/123' }; init(options); assertEquals('defaultIntegrations' in options, false); - const second = init({ ...options, tracesSampleRate: 1, traceLifecycle: 'static' }); + options.tracesSampleRate = 1; + const second = init(options); const names = second.getOptions().integrations.map(i => i.name); assertArrayIncludes(names, ['Graphql']); }); From b9400728ca3951816394325aa499e57fa4c339aa Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 9 Sep 2026 11:31:31 -0700 Subject: [PATCH 5/5] fixup! Merge branch 'develop' into fix/deno-tracing-gate --- packages/deno/src/sdk.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/deno/src/sdk.ts b/packages/deno/src/sdk.ts index d08274b3dc44..3e792e2fd0d7 100644 --- a/packages/deno/src/sdk.ts +++ b/packages/deno/src/sdk.ts @@ -105,7 +105,7 @@ export function init(options: DenoOptions = {}): Client { const clientOptions: ServerRuntimeClientOptions = { ...options, stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser), - integrations: getIntegrationsToSetup({ integrations: options.integrations, defaultIntegrations }), + integrations: getIntegrationsToSetup({ integrations: options.integrations, defaultIntegrations }), transport: options.transport || makeFetchTransport, };