Skip to content

feat(bun/v8): Remove all deprecations from Bun SDK #10971

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
Mar 8, 2024
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 @@ -54,6 +54,13 @@ const DEPENDENTS: Dependent[] = [
'NodeClient',
'hapiErrorPlugin',
'makeNodeTransport',
// TODO: remove these when we switch exports from nodeExperimentalExports to nodeExports
'Integrations',
'addGlobalEventProcessor',
'getActiveTransaction',
'getCurrentHub',
'makeMain',
'startTransaction',
],
},
{
Expand Down
19 changes: 0 additions & 19 deletions packages/bun/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export type { TransactionNamingScheme } from '@sentry/node-experimental';
export type { BunOptions } from './types';

export {
// eslint-disable-next-line deprecation/deprecation
addGlobalEventProcessor,
addEventProcessor,
addBreadcrumb,
addIntegration,
Expand All @@ -33,22 +31,14 @@ export {
close,
createTransport,
flush,
// eslint-disable-next-line deprecation/deprecation
getActiveTransaction,
// eslint-disable-next-line deprecation/deprecation
getCurrentHub,
getClient,
isInitialized,
getCurrentScope,
getGlobalScope,
getIsolationScope,
Hub,
// eslint-disable-next-line deprecation/deprecation
makeMain,
setCurrentClient,
Scope,
// eslint-disable-next-line deprecation/deprecation
startTransaction,
SDK_VERSION,
setContext,
setExtra,
Expand Down Expand Up @@ -119,13 +109,4 @@ export {
init,
} from './sdk';

import { Integrations as NodeIntegrations } from '@sentry/node-experimental';
import { BunServer } from './integrations/bunserver';
export { bunServerIntegration } from './integrations/bunserver';

const INTEGRATIONS = {
...NodeIntegrations,
BunServer,
};

export { INTEGRATIONS as Integrations };
16 changes: 10 additions & 6 deletions packages/bun/src/integrations/bunserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
Transaction,
captureException,
continueTrace,
convertIntegrationFnToClass,
defineIntegration,
getCurrentScope,
setHttpStatus,
Expand All @@ -25,15 +24,20 @@ const _bunServerIntegration = (() => {
};
}) satisfies IntegrationFn;

export const bunServerIntegration = defineIntegration(_bunServerIntegration);

/**
* Instruments `Bun.serve` to automatically create transactions and capture errors.
*
* @deprecated Use `bunServerIntegration()` instead.
* Enabled by default in the Bun SDK.
*
* ```js
* Sentry.init({
* integrations: [
* Sentry.bunServerIntegration(),
* ],
* })
* ```
*/
// eslint-disable-next-line deprecation/deprecation
export const BunServer = convertIntegrationFnToClass(INTEGRATION_NAME, bunServerIntegration);
export const bunServerIntegration = defineIntegration(_bunServerIntegration);

/**
* Instruments Bun.serve by patching it's options.
Expand Down
2 changes: 0 additions & 2 deletions packages/bun/test/integrations/bunserver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ describe('Bun Serve Integration', () => {
// span.endTimestamp is already set in `finishTransaction` hook
expect(transaction.isRecording()).toBe(false);

// eslint-disable-next-line deprecation/deprecation
expect(transaction.metadata?.dynamicSamplingContext).toStrictEqual({ version: '1.0', environment: 'production' });
expect(getDynamicSamplingContextFromSpan(transaction)).toStrictEqual({
version: '1.0',
environment: 'production',
Expand Down