Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ module.exports = [
import: createImport('init'),
ignore: [...builtinModules, ...nodePrefixedBuiltinModules],
gzip: true,
limit: '51 KB',
limit: '52 KB',
},
// Node SDK (ESM)
{
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-serverless/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { awsLambdaIntegration } from './integration/awslambda';
*/
// NOTE: in awslambda-auto.ts, we also call the original `getDefaultIntegrations` from `@sentry/node` to load performance integrations.
// If at some point we need to filter a node integration out for good, we need to make sure to also filter it out there.
export function getDefaultIntegrations(_options: Options): Integration[] {
return [...getDefaultIntegrationsWithoutPerformance(), awsIntegration(), awsLambdaIntegration()];
export function getDefaultIntegrations(options: Options): Integration[] {
return [...getDefaultIntegrationsWithoutPerformance(options), awsIntegration(), awsLambdaIntegration()];
}

export interface AwsServerlessOptions extends NodeOptions {
Expand Down
17 changes: 14 additions & 3 deletions packages/bun/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as os from 'node:os';
import type { Integration, Options } from '@sentry/core';
import {
applySdkMetadata,
consoleLoggingIntegration,
functionToStringIntegration,
hasSpansEnabled,
inboundFiltersIntegration,
Expand All @@ -26,9 +27,9 @@ import { makeFetchTransport } from './transports';
import type { BunOptions } from './types';

/** Get the default integrations for the Bun 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 [
const integrations = [
// Common
// TODO(v11): Replace with eventFiltersIntegration once we remove the deprecated `inboundFiltersIntegration`
// eslint-disable-next-line deprecation/deprecation
Expand All @@ -49,8 +50,18 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
modulesIntegration(),
// Bun Specific
bunServerIntegration(),
...(hasSpansEnabled(_options) ? getAutoPerformanceIntegrations() : []),
];

if (options.enableLogs) {
// TODO(v11): Remove this once we add logs to the `consoleIntegration`.
integrations.push(consoleLoggingIntegration());
}
Comment on lines +55 to +58
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no action required: Not sure if it makes sense to unify consoleIntegration and consoleLoggingIntegration. Probably depends on our plan for breadcrumbs going forward but I kinda like smaller single-purpose integrations over larger ones.


if (hasSpansEnabled(options)) {
integrations.push(...getAutoPerformanceIntegrations());
}

return integrations;
}

/**
Expand Down
19 changes: 15 additions & 4 deletions packages/cloudflare/src/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Integration } from '@sentry/core';
import {
consoleIntegration,
consoleLoggingIntegration,
dedupeIntegration,
functionToStringIntegration,
getIntegrationsToSetup,
Expand All @@ -22,10 +23,7 @@ import { defaultStackParser } from './vendor/stacktrace';
/** Get the default integrations for the Cloudflare SDK. */
export function getDefaultIntegrations(options: CloudflareOptions): Integration[] {
const sendDefaultPii = options.sendDefaultPii ?? false;
return [
// The Dedupe integration should not be used in workflows because we want to
// capture all step failures, even if they are the same error.
...(options.enableDedupe === false ? [] : [dedupeIntegration()]),
const integrations = [
// TODO(v11): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration`
// eslint-disable-next-line deprecation/deprecation
inboundFiltersIntegration(),
Expand All @@ -37,6 +35,19 @@ export function getDefaultIntegrations(options: CloudflareOptions): Integration[
requestDataIntegration(sendDefaultPii ? undefined : { include: { cookies: false } }),
consoleIntegration(),
];

// The Dedupe integration should not be used in workflows because we want to
// capture all step failures, even if they are the same error.
if (options.enableDedupe) {
integrations.push(dedupeIntegration());
}

if (options.enableLogs) {
// TODO(v11): Remove this once we add logs to the `consoleIntegration`.
integrations.push(consoleLoggingIntegration());
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Integration Defaults Changed, Breaking Behavior

The dedupeIntegration's default behavior changed: it's now disabled when options.enableDedupe is undefined, previously it was enabled. This is a breaking change. Additionally, consoleLoggingIntegration isn't enabled by default as intended, requiring explicit opt-in since options.enableLogs lacks a default value.

Fix in Cursor Fix in Web


return integrations;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/google-cloud-serverless/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ function getCjsOnlyIntegrations(): Integration[] {
}

/** Get the default integrations for the GCP SDK. */
export function getDefaultIntegrations(_options: Options): Integration[] {
return [...getDefaultIntegrationsWithoutPerformance(), ...getCjsOnlyIntegrations()];
export function getDefaultIntegrations(options: Options): Integration[] {
return [...getDefaultIntegrationsWithoutPerformance(options), ...getCjsOnlyIntegrations()];
}

/**
Expand Down
12 changes: 10 additions & 2 deletions packages/node-core/src/sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Integration, Options } from '@sentry/core';
import {
applySdkMetadata,
consoleIntegration,
consoleLoggingIntegration,
consoleSandbox,
debug,
functionToStringIntegration,
Expand Down Expand Up @@ -44,8 +45,8 @@ import { initializeEsmLoader } from './esmLoader';
/**
* Get default integrations for the Node-Core SDK.
*/
export function getDefaultIntegrations(): Integration[] {
return [
export function getDefaultIntegrations(options: NodeOptions = {}): Integration[] {
const integrations = [
// Common
// TODO(v11): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration`
// eslint-disable-next-line deprecation/deprecation
Expand All @@ -69,6 +70,13 @@ export function getDefaultIntegrations(): Integration[] {
processSessionIntegration(),
modulesIntegration(),
];

if (options.enableLogs) {
// TODO(v11): Remove this once we add logs to the `consoleIntegration`.
integrations.push(consoleLoggingIntegration());
}

return integrations;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/node/src/sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { initOpenTelemetry } from './initOtel';
/**
* Get default integrations, excluding performance.
*/
export function getDefaultIntegrationsWithoutPerformance(): Integration[] {
const nodeCoreIntegrations = getNodeCoreDefaultIntegrations();
export function getDefaultIntegrationsWithoutPerformance(options: Options): Integration[] {
const nodeCoreIntegrations = getNodeCoreDefaultIntegrations(options);

// Filter out the node-core HTTP and NodeFetch integrations and replace them with Node SDK's composite versions
return nodeCoreIntegrations
Expand All @@ -27,7 +27,7 @@ export function getDefaultIntegrationsWithoutPerformance(): Integration[] {
/** Get the default integrations for the Node SDK. */
export function getDefaultIntegrations(options: Options): Integration[] {
return [
...getDefaultIntegrationsWithoutPerformance(),
...getDefaultIntegrationsWithoutPerformance(options),
// We only add performance integrations if tracing is enabled
// Note that this means that without tracing enabled, e.g. `expressIntegration()` will not be added
// This means that generally request isolation will work (because that is done by httpIntegration)
Expand Down
19 changes: 15 additions & 4 deletions packages/vercel-edge/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import type { Client, Integration, Options } from '@sentry/core';
import {
consoleIntegration,
consoleLoggingIntegration,
createStackParser,
debug,
dedupeIntegration,
Expand Down Expand Up @@ -48,9 +49,9 @@ declare const process: {

const nodeStackParser = createStackParser(nodeStackLineParser());

/** Get the default integrations for the browser SDK. */
/** Get the default integrations for the Vercel Edge SDK. */
export function getDefaultIntegrations(options: Options): Integration[] {
return [
const integrations = [
dedupeIntegration(),
// TODO(v11): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration`
// eslint-disable-next-line deprecation/deprecation
Expand All @@ -59,9 +60,19 @@ export function getDefaultIntegrations(options: Options): Integration[] {
linkedErrorsIntegration(),
winterCGFetchIntegration(),
consoleIntegration(),
// TODO(v11): integration can be included - but integration should not add IP address etc
...(options.sendDefaultPii ? [requestDataIntegration()] : []),
];

if (options.enableLogs) {
// TODO(v11): Remove this once we add logs to the `consoleIntegration`.
integrations.push(consoleLoggingIntegration());
}

if (options.sendDefaultPii) {
// TODO(v11): integration can be included - but integration should not add IP address etc
integrations.push(requestDataIntegration());
}

return integrations;
}

/** Inits the Sentry NextJS SDK on the Edge Runtime. */
Expand Down
Loading