diff --git a/.size-limit.js b/.size-limit.js index 32d5d19e1495..806bdc84020b 100644 --- a/.size-limit.js +++ b/.size-limit.js @@ -224,7 +224,7 @@ module.exports = [ import: createImport('init'), ignore: [...builtinModules, ...nodePrefixedBuiltinModules], gzip: true, - limit: '51 KB', + limit: '52 KB', }, // Node SDK (ESM) { diff --git a/packages/aws-serverless/src/init.ts b/packages/aws-serverless/src/init.ts index e19cc41baf46..0ef4494802b5 100644 --- a/packages/aws-serverless/src/init.ts +++ b/packages/aws-serverless/src/init.ts @@ -48,8 +48,8 @@ function shouldDisableLayerExtensionForProxy(): boolean { */ // 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 { diff --git a/packages/bun/src/sdk.ts b/packages/bun/src/sdk.ts index bf0e6f58ee90..8f228a4740e2 100644 --- a/packages/bun/src/sdk.ts +++ b/packages/bun/src/sdk.ts @@ -2,6 +2,7 @@ import * as os from 'node:os'; import type { Integration, Options } from '@sentry/core'; import { applySdkMetadata, + consoleLoggingIntegration, functionToStringIntegration, hasSpansEnabled, inboundFiltersIntegration, @@ -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 @@ -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()); + } + + if (hasSpansEnabled(options)) { + integrations.push(...getAutoPerformanceIntegrations()); + } + + return integrations; } /** diff --git a/packages/cloudflare/src/sdk.ts b/packages/cloudflare/src/sdk.ts index 238cc13253a5..a783881aa014 100644 --- a/packages/cloudflare/src/sdk.ts +++ b/packages/cloudflare/src/sdk.ts @@ -1,6 +1,7 @@ import type { Integration } from '@sentry/core'; import { consoleIntegration, + consoleLoggingIntegration, dedupeIntegration, functionToStringIntegration, getIntegrationsToSetup, @@ -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(), @@ -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()); + } + + return integrations; } /** diff --git a/packages/google-cloud-serverless/src/sdk.ts b/packages/google-cloud-serverless/src/sdk.ts index 2699eb4f9e2f..adac82806bb3 100644 --- a/packages/google-cloud-serverless/src/sdk.ts +++ b/packages/google-cloud-serverless/src/sdk.ts @@ -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()]; } /** diff --git a/packages/node-core/src/sdk/index.ts b/packages/node-core/src/sdk/index.ts index d53f5d4faefb..4b1aa1b97ee3 100644 --- a/packages/node-core/src/sdk/index.ts +++ b/packages/node-core/src/sdk/index.ts @@ -2,6 +2,7 @@ import type { Integration, Options } from '@sentry/core'; import { applySdkMetadata, consoleIntegration, + consoleLoggingIntegration, consoleSandbox, debug, functionToStringIntegration, @@ -45,8 +46,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 @@ -70,6 +71,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; } /** diff --git a/packages/node/src/sdk/index.ts b/packages/node/src/sdk/index.ts index 6942c6500f84..6773b4f98f52 100644 --- a/packages/node/src/sdk/index.ts +++ b/packages/node/src/sdk/index.ts @@ -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 @@ -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) diff --git a/packages/vercel-edge/src/sdk.ts b/packages/vercel-edge/src/sdk.ts index 5c8387c9bc7a..0f6ff08c860a 100644 --- a/packages/vercel-edge/src/sdk.ts +++ b/packages/vercel-edge/src/sdk.ts @@ -9,6 +9,7 @@ import { import type { Client, Integration, Options } from '@sentry/core'; import { consoleIntegration, + consoleLoggingIntegration, createStackParser, debug, dedupeIntegration, @@ -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 @@ -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. */