File tree 13 files changed +748
-3
lines changed
e2e-tests/test-applications/node-exports-test-app/scripts
node-integration-tests/suites
breadcrumbs/process-thread
google-cloud-serverless/src
13 files changed +748
-3
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ const DEPENDENTS: Dependent[] = [
50
50
ignoreExports : [
51
51
// not supported in bun:
52
52
'NodeClient' ,
53
+ // Bun doesn't emit the required diagnostics_channel events
54
+ 'processThreadBreadcrumbIntegration' ,
53
55
] ,
54
56
} ,
55
57
{
Original file line number Diff line number Diff line change @@ -56,12 +56,12 @@ const ANR_EVENT_WITH_SCOPE = {
56
56
user : {
57
57
58
58
} ,
59
- breadcrumbs : [
59
+ breadcrumbs : expect . arrayContaining ( [
60
60
{
61
61
timestamp : expect . any ( Number ) ,
62
62
message : 'important message!' ,
63
63
} ,
64
- ] ,
64
+ ] ) ,
65
65
} ;
66
66
67
67
conditionalTest ( { min : 16 } ) ( 'should report ANR when event loop blocked' , ( ) => {
Original file line number Diff line number Diff line change
1
+ import { spawn } from 'child_process' ;
2
+ import { join } from 'path' ;
3
+ import { loggingTransport } from '@sentry-internal/node-integration-tests' ;
4
+ import * as Sentry from '@sentry/node' ;
5
+ import { Worker } from 'worker_threads' ;
6
+
7
+ const __dirname = new URL ( '.' , import . meta. url ) . pathname ;
8
+
9
+ Sentry . init ( {
10
+ dsn :
'https://[email protected] /1337' ,
11
+ release : '1.0' ,
12
+ transport : loggingTransport ,
13
+ } ) ;
14
+
15
+ await new Promise ( resolve => {
16
+ const child = spawn ( 'sleep' , [ 'a' ] ) ;
17
+ child . on ( 'error' , resolve ) ;
18
+ child . on ( 'exit' , resolve ) ;
19
+ } ) ;
20
+
21
+ await new Promise ( resolve => {
22
+ const worker = new Worker ( join ( __dirname , 'worker.mjs' ) ) ;
23
+ worker . on ( 'error' , resolve ) ;
24
+ worker . on ( 'exit' , resolve ) ;
25
+ } ) ;
26
+
27
+ throw new Error ( 'This is a test error' ) ;
Original file line number Diff line number Diff line change
1
+ import type { Event } from '@sentry/types' ;
2
+ import { conditionalTest } from '../../../utils' ;
3
+ import { cleanupChildProcesses , createRunner } from '../../../utils/runner' ;
4
+
5
+ const EVENT = {
6
+ // and an exception that is our ANR
7
+ exception : {
8
+ values : [
9
+ {
10
+ type : 'Error' ,
11
+ value : 'This is a test error' ,
12
+ } ,
13
+ ] ,
14
+ } ,
15
+ breadcrumbs : [
16
+ {
17
+ timestamp : expect . any ( Number ) ,
18
+ category : 'child_process' ,
19
+ message : "Child process exited with code '1'" ,
20
+ level : 'warning' ,
21
+ data : {
22
+ spawnfile : 'sleep' ,
23
+ } ,
24
+ } ,
25
+ {
26
+ timestamp : expect . any ( Number ) ,
27
+ category : 'worker_thread' ,
28
+ message : "Worker thread errored with 'Worker error'" ,
29
+ level : 'error' ,
30
+ data : {
31
+ threadId : expect . any ( Number ) ,
32
+ } ,
33
+ } ,
34
+ ] ,
35
+ } ;
36
+
37
+ conditionalTest ( { min : 20 } ) ( 'should capture process and thread breadcrumbs' , ( ) => {
38
+ afterAll ( ( ) => {
39
+ cleanupChildProcesses ( ) ;
40
+ } ) ;
41
+
42
+ test ( 'ESM' , done => {
43
+ createRunner ( __dirname , 'app.mjs' )
44
+ . withMockSentryServer ( )
45
+ . expect ( { event : EVENT as Event } )
46
+ . start ( done ) ;
47
+ } ) ;
48
+ } ) ;
Original file line number Diff line number Diff line change
1
+ throw new Error ( 'Worker error' ) ;
Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ export {
89
89
parameterize ,
90
90
postgresIntegration ,
91
91
prismaIntegration ,
92
+ processThreadBreadcrumbIntegration ,
92
93
redisIntegration ,
93
94
requestDataIntegration ,
94
95
rewriteFramesIntegration ,
Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ export {
102
102
setupNestErrorHandler ,
103
103
postgresIntegration ,
104
104
prismaIntegration ,
105
+ processThreadBreadcrumbIntegration ,
105
106
hapiIntegration ,
106
107
setupHapiErrorHandler ,
107
108
spotlightIntegration ,
Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ export {
114
114
zodErrorsIntegration ,
115
115
profiler ,
116
116
amqplibIntegration ,
117
+ processThreadBreadcrumbIntegration ,
117
118
} from '@sentry/node' ;
118
119
119
120
export {
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ export { spotlightIntegration } from './integrations/spotlight';
31
31
export { genericPoolIntegration } from './integrations/tracing/genericPool' ;
32
32
export { dataloaderIntegration } from './integrations/tracing/dataloader' ;
33
33
export { amqplibIntegration } from './integrations/tracing/amqplib' ;
34
+ export { processThreadBreadcrumbIntegration } from './integrations/processThread' ;
34
35
35
36
export { SentryContextManager } from './otel/contextManager' ;
36
37
export { generateInstrumentOnce } from './otel/instrument' ;
You can’t perform that action at this time.
0 commit comments