(options: Options)
| 30 | |
| 31 | /** Get the default integrations for the Node SDK. */ |
| 32 | export function getDefaultIntegrations(options: Options): Integration[] { |
| 33 | const integrations: Integration[] = [ |
| 34 | ...getDefaultIntegrationsWithoutPerformance(), |
| 35 | // We only add performance integrations if tracing is enabled |
| 36 | // Note that this means that without tracing enabled, e.g. `expressIntegration()` will not be added |
| 37 | // This means that generally request isolation will work (because that is done by httpIntegration) |
| 38 | // But `transactionName` will not be set automatically |
| 39 | ...(hasSpansEnabled(options) ? getAutoPerformanceIntegrations() : []), |
| 40 | ]; |
| 41 | |
| 42 | // When the app opted into diagnostics-channel injection (via |
| 43 | // `experimentalUseDiagnosticsChannelInjection()`) AND span recording is |
| 44 | // enabled, swap the channel-based integrations in place of OTel equivalents |
| 45 | // so the two don't both instrument the same library. |
| 46 | // |
| 47 | // Every channel-based integration we ship today is a 1:1 replacement for an |
| 48 | // OTel performance/tracing integration and produces nothing but spans (those |
| 49 | // only come from `getAutoPerformanceIntegrations()` above), so it's gated on |
| 50 | // span recording. |
| 51 | if (isDiagnosticsChannelInjectionEnabled() && hasSpansEnabled(options)) { |
| 52 | const diagnosticsChannelInjection = resolveDiagnosticsChannelInjection(); |
| 53 | if (diagnosticsChannelInjection) { |
| 54 | const replaced = new Set(diagnosticsChannelInjection.replacedOtelIntegrationNames); |
| 55 | return [...integrations.filter(i => !replaced.has(i.name)), ...diagnosticsChannelInjection.integrations]; |
| 56 | } |
| 57 | } |
| 58 | return integrations; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Initialize Sentry for Node. |
no test coverage detected