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 dd9c526ac32e..077e1bd9f5bb 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 702baa6f175f..1c8efe1364e9 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 2880f7c490dd..c47715c6a9fc 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 4bb448797cad..7e9f2d6ec34c 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..3e792e2fd0d7 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,15 @@ 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 + // 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, stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser), - integrations: getIntegrationsToSetup(options), + integrations: getIntegrationsToSetup({ integrations: options.integrations, 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: [ 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..ad7152cb21ba 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,42 @@ 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); + options.tracesSampleRate = 1; + const second = init(options); + const names = second.getOptions().integrations.map(i => i.name); + assertArrayIncludes(names, ['Graphql']); +});