Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ async function assertParseSpan(channelName: string): Promise<void> {

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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
});
Expand Down
14 changes: 8 additions & 6 deletions packages/deno/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
eventFiltersIntegration,
functionToStringIntegration,
getIntegrationsToSetup,
hasSpansEnabled,
initAndBind,
linkedErrorsIntegration,
requestDataIntegration,
Expand All @@ -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
Expand All @@ -45,7 +46,7 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
globalHandlersIntegration(),
// server-utils integrations
...getErrorIntegrations(),
...getTracingIntegrations(),
...(hasSpansEnabled(options) ? getTracingIntegrations() : []),
];
}

Expand Down Expand Up @@ -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);
Comment thread
sentry[bot] marked this conversation as resolved.

const clientOptions: ServerRuntimeClientOptions = {
...options,
stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),
integrations: getIntegrationsToSetup(options),
integrations: getIntegrationsToSetup({ integrations: options.integrations, defaultIntegrations }),
transport: options.transport || makeFetchTransport,
};

Expand Down
Loading
Loading