File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { configureScope } from '@sentry/core' ;
2
2
import type { NodeOptions } from '@sentry/node' ;
3
- import { init as initNodeSdk } from '@sentry/node' ;
3
+ import { init as initNodeSdk , Integrations } from '@sentry/node' ;
4
+ import { addOrUpdateIntegration } from '@sentry/utils' ;
4
5
5
6
import { applySdkMetadata } from '../common/metadata' ;
6
7
@@ -11,9 +12,15 @@ import { applySdkMetadata } from '../common/metadata';
11
12
export function init ( options : NodeOptions ) : void {
12
13
applySdkMetadata ( options , [ 'sveltekit' , 'node' ] ) ;
13
14
15
+ addServerIntegrations ( options ) ;
16
+
14
17
initNodeSdk ( options ) ;
15
18
16
19
configureScope ( scope => {
17
20
scope . setTag ( 'runtime' , 'node' ) ;
18
21
} ) ;
19
22
}
23
+
24
+ function addServerIntegrations ( options : NodeOptions ) : void {
25
+ options . integrations = addOrUpdateIntegration ( new Integrations . Undici ( ) , options . integrations || [ ] ) ;
26
+ }
Original file line number Diff line number Diff line change @@ -47,5 +47,20 @@ describe('Sentry server SDK', () => {
47
47
// @ts -ignore need access to protected _tags attribute
48
48
expect ( currentScope . _tags ) . toEqual ( { runtime : 'node' } ) ;
49
49
} ) ;
50
+
51
+ it ( 'adds the Undici integration' , ( ) => {
52
+ init ( { } ) ;
53
+
54
+ expect ( nodeInit ) . toHaveBeenCalledTimes ( 1 ) ;
55
+ expect ( nodeInit ) . toHaveBeenCalledWith (
56
+ expect . objectContaining ( {
57
+ integrations : expect . arrayContaining ( [
58
+ expect . objectContaining ( {
59
+ name : 'Undici' ,
60
+ } ) ,
61
+ ] ) ,
62
+ } ) ,
63
+ ) ;
64
+ } ) ;
50
65
} ) ;
51
66
} ) ;
You can’t perform that action at this time.
0 commit comments