Skip to content

Commit 7879791

Browse files
authored
feat(v8/bun): Update @sentry/bun to use OTEL node (#10997)
ref #9956 Given Bun is just a wrapper over Node, we should be good to go with just these changes.
1 parent 39360d9 commit 7879791

File tree

7 files changed

+75
-84
lines changed

7 files changed

+75
-84
lines changed

dev-packages/e2e-tests/test-applications/node-exports-test-app/scripts/consistentExports.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,13 @@ const DEPENDENTS: Dependent[] = [
5353
},
5454
{
5555
package: '@sentry/bun',
56-
compareWith: nodeExperimentalExports,
56+
compareWith: nodeExports,
5757
exports: Object.keys(SentryBun),
5858
ignoreExports: [
5959
// not supported in bun:
60-
'Handlers',
6160
'NodeClient',
62-
'hapiErrorPlugin',
63-
'makeNodeTransport',
64-
// TODO: remove these when we switch exports from nodeExperimentalExports to nodeExports
65-
'Integrations',
66-
'addGlobalEventProcessor',
67-
'getActiveTransaction',
68-
'getCurrentHub',
61+
// legacy, to be removed...
6962
'makeMain',
70-
'startTransaction',
7163
],
7264
},
7365
{

packages/bun/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"types",
1616
"types-ts3.8"
1717
],
18-
"main": "build/esm/index.js",
18+
"main": "build/cjs/index.js",
1919
"module": "build/esm/index.js",
2020
"types": "build/types/index.d.ts",
2121
"exports": {
@@ -33,8 +33,8 @@
3333
},
3434
"typesVersions": {
3535
"<4.9": {
36-
"build/npm/types/index.d.ts": [
37-
"build/npm/types-ts3.8/index.d.ts"
36+
"build/types/index.d.ts": [
37+
"build/types-ts3.8/index.d.ts"
3838
]
3939
}
4040
},
@@ -43,7 +43,7 @@
4343
},
4444
"dependencies": {
4545
"@sentry/core": "8.0.0-alpha.2",
46-
"@sentry/node-experimental": "8.0.0-alpha.2",
46+
"@sentry/node": "8.0.0-alpha.2",
4747
"@sentry/types": "8.0.0-alpha.2",
4848
"@sentry/utils": "8.0.0-alpha.2"
4949
},

packages/bun/rollup.npm.config.mjs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils';
22

3-
const config = makeNPMConfigVariants(makeBaseNPMConfig());
4-
5-
// remove cjs from config array config[0].output.format == cjs
6-
export default [config[1]];
3+
export default makeNPMConfigVariants(makeBaseNPMConfig());

packages/bun/src/client.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as os from 'os';
22
import type { ServerRuntimeClientOptions } from '@sentry/core';
3-
import { applySdkMetadata } from '@sentry/core';
4-
import { ServerRuntimeClient } from '@sentry/core';
3+
import { ServerRuntimeClient, applySdkMetadata } from '@sentry/core';
54

65
import type { BunClientOptions } from './types';
76

packages/bun/src/index.ts

Lines changed: 62 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,21 @@ export type {
1818
} from '@sentry/types';
1919
export type { AddRequestDataToEventOptions } from '@sentry/utils';
2020

21-
export type { TransactionNamingScheme } from '@sentry/node-experimental';
22-
export type { BunOptions } from './types';
23-
2421
export {
2522
addEventProcessor,
2623
addBreadcrumb,
2724
addIntegration,
2825
captureException,
2926
captureEvent,
3027
captureMessage,
31-
close,
28+
captureCheckIn,
29+
startSession,
30+
captureSession,
31+
endSession,
32+
withMonitor,
3233
createTransport,
33-
flush,
34+
// eslint-disable-next-line deprecation/deprecation
35+
getCurrentHub,
3436
getClient,
3537
isInitialized,
3638
getCurrentScope,
@@ -50,64 +52,80 @@ export {
5052
setHttpStatus,
5153
withScope,
5254
withIsolationScope,
53-
captureCheckIn,
54-
withMonitor,
55+
makeNodeTransport,
56+
NodeClient,
57+
defaultStackParser,
58+
flush,
59+
close,
60+
getSentryRelease,
61+
addRequestDataToEvent,
62+
DEFAULT_USER_INCLUDES,
63+
extractRequestData,
64+
createGetModuleFromFilename,
65+
anrIntegration,
66+
consoleIntegration,
67+
httpIntegration,
68+
nativeNodeFetchIntegration,
69+
onUncaughtExceptionIntegration,
70+
onUnhandledRejectionIntegration,
71+
modulesIntegration,
72+
contextLinesIntegration,
73+
nodeContextIntegration,
74+
localVariablesIntegration,
75+
requestDataIntegration,
76+
functionToStringIntegration,
77+
inboundFiltersIntegration,
78+
linkedErrorsIntegration,
5579
setMeasurement,
5680
getActiveSpan,
57-
getRootSpan,
5881
startSpan,
5982
startInactiveSpan,
6083
startSpanManual,
6184
withActiveSpan,
85+
getRootSpan,
6286
getSpanDescendants,
6387
continueTrace,
64-
metricsDefault as metrics,
65-
functionToStringIntegration,
66-
inboundFiltersIntegration,
67-
linkedErrorsIntegration,
68-
requestDataIntegration,
88+
getAutoPerformanceIntegrations,
89+
cron,
90+
metrics,
91+
parameterize,
92+
SEMANTIC_ATTRIBUTE_SENTRY_OP,
93+
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
94+
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
95+
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
96+
expressIntegration,
97+
expressErrorHandler,
98+
setupExpressErrorHandler,
99+
fastifyIntegration,
100+
setupFastifyErrorHandler,
101+
graphqlIntegration,
102+
mongoIntegration,
103+
mongooseIntegration,
104+
mysqlIntegration,
105+
mysql2Integration,
106+
nestIntegration,
107+
postgresIntegration,
108+
prismaIntegration,
109+
hapiIntegration,
110+
setupHapiErrorHandler,
111+
spotlightIntegration,
112+
} from '@sentry/node';
113+
114+
export {
69115
captureConsoleIntegration,
70116
debugIntegration,
71117
dedupeIntegration,
72118
extraErrorDataIntegration,
73119
rewriteFramesIntegration,
74120
sessionTimingIntegration,
75-
parameterize,
76-
startSession,
77-
captureSession,
78-
endSession,
79121
} from '@sentry/core';
80-
export {
81-
DEFAULT_USER_INCLUDES,
82-
autoDiscoverNodePerformanceMonitoringIntegrations,
83-
cron,
84-
createGetModuleFromFilename,
85-
defaultStackParser,
86-
extractRequestData,
87-
getSentryRelease,
88-
addRequestDataToEvent,
89-
anrIntegration,
90-
consoleIntegration,
91-
contextLinesIntegration,
92-
hapiIntegration,
93-
httpIntegration,
94-
localVariablesIntegration,
95-
modulesIntegration,
96-
nativeNodeFetchintegration,
97-
nodeContextIntegration,
98-
onUncaughtExceptionIntegration,
99-
onUnhandledRejectionIntegration,
100-
spotlightIntegration,
101-
SEMANTIC_ATTRIBUTE_SENTRY_OP,
102-
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
103-
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
104-
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
105-
} from '@sentry/node-experimental';
122+
123+
export type { BunOptions } from './types';
106124

107125
export { BunClient } from './client';
108126
export {
109127
getDefaultIntegrations,
110128
init,
111129
} from './sdk';
112-
113130
export { bunServerIntegration } from './integrations/bunserver';
131+
export { makeFetchTransport } from './transports';

packages/bun/src/sdk.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable max-lines */
21
import {
32
functionToStringIntegration,
43
inboundFiltersIntegration,
@@ -11,9 +10,9 @@ import {
1110
httpIntegration,
1211
init as initNode,
1312
modulesIntegration,
14-
nativeNodeFetchintegration,
13+
nativeNodeFetchIntegration,
1514
nodeContextIntegration,
16-
} from '@sentry/node-experimental';
15+
} from '@sentry/node';
1716
import type { Integration, Options } from '@sentry/types';
1817

1918
import { BunClient } from './client';
@@ -33,7 +32,7 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
3332
// Native Wrappers
3433
consoleIntegration(),
3534
httpIntegration(),
36-
nativeNodeFetchintegration(),
35+
nativeNodeFetchIntegration(),
3736
// Global Handlers # TODO (waiting for https://github.com/oven-sh/bun/issues/5091)
3837
// new NodeIntegrations.OnUncaughtException(),
3938
// new NodeIntegrations.OnUnhandledRejection(),

packages/bun/tsconfig.json

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,7 @@
44
"include": ["src/**/*"],
55

66
"compilerOptions": {
7-
"types": ["bun-types"],
8-
"lib": ["esnext"],
9-
"module": "esnext",
10-
"target": "esnext",
11-
12-
// if TS 4.x or earlier
13-
"moduleResolution": "nodenext",
14-
15-
"jsx": "react-jsx", // support JSX
16-
"allowJs": true, // allow importing `.js` from `.ts`
17-
"esModuleInterop": true, // allow default imports for CommonJS modules
18-
19-
// best practices
20-
"strict": true,
21-
"forceConsistentCasingInFileNames": true,
22-
"skipLibCheck": true
7+
// package-specific options
8+
"types": ["bun-types"]
239
}
2410
}

0 commit comments

Comments
 (0)