@@ -12,7 +12,9 @@ test('Sends an API route transaction to OTLP', async ({ baseURL }) => {
1212
1313 const scopeSpans = json . resourceSpans ?. [ 0 ] ?. scopeSpans ;
1414
15- const httpScope = scopeSpans ?. find ( scopeSpan => scopeSpan . scope . name === '@opentelemetry/instrumentation-http' ) ;
15+ const httpScope = scopeSpans ?. find (
16+ scopeSpan => scopeSpan . scope . name === '@opentelemetry_sentry-patched/instrumentation-http' ,
17+ ) ;
1618
1719 return (
1820 httpScope &&
@@ -22,7 +24,7 @@ test('Sends an API route transaction to OTLP', async ({ baseURL }) => {
2224 ) ;
2325 } ) ;
2426
25- await fetch ( `${ baseURL } /test-transaction` ) ;
27+ fetch ( `${ baseURL } /test-transaction` ) ;
2628
2729 const otelData = await otelPromise ;
2830
@@ -38,7 +40,9 @@ test('Sends an API route transaction to OTLP', async ({ baseURL }) => {
3840 // But our default node-fetch spans are not emitted
3941 expect ( scopeSpans . length ) . toEqual ( 2 ) ;
4042
41- const httpScopes = scopeSpans ?. filter ( scopeSpan => scopeSpan . scope . name === '@opentelemetry/instrumentation-http' ) ;
43+ const httpScopes = scopeSpans ?. filter (
44+ scopeSpan => scopeSpan . scope . name === '@opentelemetry_sentry-patched/instrumentation-http' ,
45+ ) ;
4246 const undiciScopes = scopeSpans ?. filter (
4347 scopeSpan => scopeSpan . scope . name === '@opentelemetry/instrumentation-undici' ,
4448 ) ;
@@ -49,6 +53,38 @@ test('Sends an API route transaction to OTLP', async ({ baseURL }) => {
4953 expect ( undiciScopes . length ) . toBe ( 1 ) ;
5054 expect ( undiciScopes [ 0 ] . spans . length ) . toBe ( 1 ) ;
5155
56+ expect ( undiciScopes [ 0 ] . spans ) . toEqual ( [
57+ {
58+ traceId : expect . any ( String ) ,
59+ spanId : expect . any ( String ) ,
60+ name : 'GET' ,
61+ kind : 3 ,
62+ startTimeUnixNano : expect . any ( String ) ,
63+ endTimeUnixNano : expect . any ( String ) ,
64+ attributes : expect . arrayContaining ( [
65+ { key : 'http.request.method' , value : { stringValue : 'GET' } } ,
66+ { key : 'http.request.method_original' , value : { stringValue : 'GET' } } ,
67+ { key : 'url.full' , value : { stringValue : 'http://localhost:3030/test-success' } } ,
68+ { key : 'url.path' , value : { stringValue : '/test-success' } } ,
69+ { key : 'url.query' , value : { stringValue : '' } } ,
70+ { key : 'url.scheme' , value : { stringValue : 'http' } } ,
71+ { key : 'server.address' , value : { stringValue : 'localhost' } } ,
72+ { key : 'server.port' , value : { intValue : 3030 } } ,
73+ { key : 'user_agent.original' , value : { stringValue : 'node' } } ,
74+ { key : 'network.peer.address' , value : { stringValue : expect . any ( String ) } } ,
75+ { key : 'network.peer.port' , value : { intValue : 3030 } } ,
76+ { key : 'http.response.status_code' , value : { intValue : 200 } } ,
77+ { key : 'http.response.header.content-length' , value : { intValue : 16 } } ,
78+ ] ) ,
79+ droppedAttributesCount : 0 ,
80+ events : [ ] ,
81+ droppedEventsCount : 0 ,
82+ status : { code : 0 } ,
83+ links : [ ] ,
84+ droppedLinksCount : 0 ,
85+ } ,
86+ ] ) ;
87+
5288 // There may be another span from another request, we can ignore that
5389 const httpSpans = httpScopes [ 0 ] . spans . filter ( span =>
5490 span . attributes . some ( attr => attr . key === 'http.target' && attr . value ?. stringValue === '/test-transaction' ) ,
@@ -62,104 +98,24 @@ test('Sends an API route transaction to OTLP', async ({ baseURL }) => {
6298 kind : 2 ,
6399 startTimeUnixNano : expect . any ( String ) ,
64100 endTimeUnixNano : expect . any ( String ) ,
65- attributes : [
66- {
67- key : 'http.url' ,
68- value : {
69- stringValue : 'http://localhost:3030/test-transaction' ,
70- } ,
71- } ,
72- {
73- key : 'http.host' ,
74- value : {
75- stringValue : 'localhost:3030' ,
76- } ,
77- } ,
78- {
79- key : 'net.host.name' ,
80- value : {
81- stringValue : 'localhost' ,
82- } ,
83- } ,
84- {
85- key : 'http.method' ,
86- value : {
87- stringValue : 'GET' ,
88- } ,
89- } ,
90- {
91- key : 'http.scheme' ,
92- value : {
93- stringValue : 'http' ,
94- } ,
95- } ,
96- {
97- key : 'http.target' ,
98- value : {
99- stringValue : '/test-transaction' ,
100- } ,
101- } ,
102- {
103- key : 'http.user_agent' ,
104- value : {
105- stringValue : 'node' ,
106- } ,
107- } ,
108- {
109- key : 'http.flavor' ,
110- value : {
111- stringValue : '1.1' ,
112- } ,
113- } ,
114- {
115- key : 'net.transport' ,
116- value : {
117- stringValue : 'ip_tcp' ,
118- } ,
119- } ,
120- {
121- key : 'sentry.origin' ,
122- value : {
123- stringValue : 'auto.http.otel.http' ,
124- } ,
125- } ,
126- {
127- key : 'net.host.ip' ,
128- value : {
129- stringValue : expect . any ( String ) ,
130- } ,
131- } ,
132- {
133- key : 'net.host.port' ,
134- value : {
135- intValue : 3030 ,
136- } ,
137- } ,
138- {
139- key : 'net.peer.ip' ,
140- value : {
141- stringValue : expect . any ( String ) ,
142- } ,
143- } ,
144- {
145- key : 'net.peer.port' ,
146- value : {
147- intValue : expect . any ( Number ) ,
148- } ,
149- } ,
150- {
151- key : 'http.status_code' ,
152- value : {
153- intValue : 200 ,
154- } ,
155- } ,
156- {
157- key : 'http.status_text' ,
158- value : {
159- stringValue : 'OK' ,
160- } ,
161- } ,
162- ] ,
101+ attributes : expect . arrayContaining ( [
102+ { key : 'http.url' , value : { stringValue : 'http://localhost:3030/test-transaction' } } ,
103+ { key : 'http.host' , value : { stringValue : 'localhost:3030' } } ,
104+ { key : 'net.host.name' , value : { stringValue : 'localhost' } } ,
105+ { key : 'http.method' , value : { stringValue : 'GET' } } ,
106+ { key : 'http.scheme' , value : { stringValue : 'http' } } ,
107+ { key : 'http.target' , value : { stringValue : '/test-transaction' } } ,
108+ { key : 'http.user_agent' , value : { stringValue : 'node' } } ,
109+ { key : 'http.flavor' , value : { stringValue : '1.1' } } ,
110+ { key : 'net.transport' , value : { stringValue : 'ip_tcp' } } ,
111+ { key : 'net.host.ip' , value : { stringValue : expect . any ( String ) } } ,
112+ { key : 'net.host.port' , value : { intValue : 3030 } } ,
113+ { key : 'net.peer.ip' , value : { stringValue : expect . any ( String ) } } ,
114+ { key : 'net.peer.port' , value : { intValue : expect . any ( Number ) } } ,
115+ { key : 'http.status_code' , value : { intValue : 200 } } ,
116+ { key : 'http.status_text' , value : { stringValue : 'OK' } } ,
117+ { key : 'sentry.origin' , value : { stringValue : 'auto.http.otel.http' } } ,
118+ ] ) ,
163119 droppedAttributesCount : 0 ,
164120 events : [ ] ,
165121 droppedEventsCount : 0 ,
0 commit comments