@@ -34,10 +34,10 @@ test('Sends an API route transaction to OTLP', async ({ baseURL }) => {
3434 const scopeSpans = json . resourceSpans ?. [ 0 ] ?. scopeSpans ;
3535 expect ( scopeSpans ) . toBeDefined ( ) ;
3636
37- // Http server span & undici client spans are emitted,
38- // as well as the spans emitted via `Sentry.startSpan()`
39- // But our default node-fetch spans are not emitted
40- expect ( scopeSpans . length ) . toEqual ( 3 ) ;
37+ // Http server span & undici client spans are emitted.
38+ // Sentry.startSpan() spans are NOT emitted (non-recording when tracing is disabled).
39+ // Our default node-fetch spans are also not emitted.
40+ expect ( scopeSpans . length ) . toEqual ( 2 ) ;
4141
4242 const httpScopes = scopeSpans ?. filter ( scopeSpan => scopeSpan . scope . name === '@opentelemetry/instrumentation-http' ) ;
4343 const undiciScopes = scopeSpans ?. filter (
@@ -47,43 +47,8 @@ test('Sends an API route transaction to OTLP', async ({ baseURL }) => {
4747
4848 expect ( httpScopes . length ) . toBe ( 1 ) ;
4949
50- expect ( startSpanScopes . length ) . toBe ( 1 ) ;
51- expect ( startSpanScopes [ 0 ] . spans . length ) . toBe ( 2 ) ;
52- expect ( startSpanScopes [ 0 ] . spans ) . toEqual ( [
53- {
54- traceId : expect . any ( String ) ,
55- spanId : expect . any ( String ) ,
56- parentSpanId : expect . any ( String ) ,
57- name : 'test-span' ,
58- kind : 1 ,
59- startTimeUnixNano : expect . any ( String ) ,
60- endTimeUnixNano : expect . any ( String ) ,
61- attributes : [ ] ,
62- droppedAttributesCount : 0 ,
63- events : [ ] ,
64- droppedEventsCount : 0 ,
65- status : { code : 0 } ,
66- links : [ ] ,
67- droppedLinksCount : 0 ,
68- flags : expect . any ( Number ) ,
69- } ,
70- {
71- traceId : expect . any ( String ) ,
72- spanId : expect . any ( String ) ,
73- name : 'test-transaction' ,
74- kind : 1 ,
75- startTimeUnixNano : expect . any ( String ) ,
76- endTimeUnixNano : expect . any ( String ) ,
77- attributes : [ { key : 'sentry.op' , value : { stringValue : 'e2e-test' } } ] ,
78- droppedAttributesCount : 0 ,
79- events : [ ] ,
80- droppedEventsCount : 0 ,
81- status : { code : 0 } ,
82- links : [ ] ,
83- droppedLinksCount : 0 ,
84- flags : expect . any ( Number ) ,
85- } ,
86- ] ) ;
50+ // Sentry spans should not be exported when tracing is disabled
51+ expect ( startSpanScopes . length ) . toBe ( 0 ) ;
8752
8853 // Undici spans are emitted correctly
8954 expect ( undiciScopes . length ) . toBe ( 1 ) ;
0 commit comments