Skip to content

feat(node): Make Undici a default integration. #7967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 26, 2023
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
2 changes: 0 additions & 2 deletions packages/nextjs/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ function addServerIntegrations(options: NodeOptions): void {
});
}

integrations = addOrUpdateIntegration(new Integrations.Undici(), integrations);

options.integrations = integrations;
}

Expand Down
9 changes: 0 additions & 9 deletions packages/nextjs/test/serverSdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,6 @@ describe('Server init()', () => {
expect(consoleIntegration).toBeDefined();
});

it('adds the Undici integration', () => {
init({});

const nodeInitOptions = nodeInit.mock.calls[0][0] as ModifiedInitOptions;
const undiciIntegration = findIntegrationByName(nodeInitOptions.integrations, 'Undici');

expect(undiciIntegration).toBeDefined();
});

describe('`Http` integration', () => {
it('adds `Http` integration with tracing enabled if `tracesSampleRate` is set', () => {
init({ tracesSampleRate: 1.0 });
Expand Down
2 changes: 2 additions & 0 deletions packages/node/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
OnUncaughtException,
OnUnhandledRejection,
RequestData,
Undici,
} from './integrations';
import { getModule } from './module';
import { makeNodeTransport } from './transports';
Expand All @@ -40,6 +41,7 @@ export const defaultIntegrations = [
// Native Wrappers
new Console(),
new Http(),
new Undici(),
// Global Handlers
new OnUncaughtException(),
new OnUnhandledRejection(),
Expand Down
3 changes: 1 addition & 2 deletions packages/sveltekit/src/server/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { configureScope } from '@sentry/core';
import { RewriteFrames } from '@sentry/integrations';
import type { NodeOptions } from '@sentry/node';
import { init as initNodeSdk, Integrations } from '@sentry/node';
import { init as initNodeSdk } from '@sentry/node';
import { addOrUpdateIntegration } from '@sentry/utils';

import { applySdkMetadata } from '../common/metadata';
Expand All @@ -24,7 +24,6 @@ export function init(options: NodeOptions): void {
}

function addServerIntegrations(options: NodeOptions): void {
options.integrations = addOrUpdateIntegration(new Integrations.Undici(), options.integrations || []);
options.integrations = addOrUpdateIntegration(
new RewriteFrames({ iteratee: rewriteFramesIteratee }),
options.integrations || [],
Expand Down
15 changes: 0 additions & 15 deletions packages/sveltekit/test/server/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,5 @@ describe('Sentry server SDK', () => {
// @ts-ignore need access to protected _tags attribute
expect(currentScope._tags).toEqual({ runtime: 'node' });
});

it('adds the Undici integration', () => {
init({});

expect(nodeInit).toHaveBeenCalledTimes(1);
expect(nodeInit).toHaveBeenCalledWith(
expect.objectContaining({
integrations: expect.arrayContaining([
expect.objectContaining({
name: 'Undici',
}),
]),
}),
);
});
});
});