@@ -12,7 +12,9 @@ test('Sends an API route transaction to OTLP', async ({ baseURL }) => {
12
12
13
13
const scopeSpans = json . resourceSpans ?. [ 0 ] ?. scopeSpans ;
14
14
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
+ ) ;
16
18
17
19
return (
18
20
httpScope &&
@@ -22,7 +24,7 @@ test('Sends an API route transaction to OTLP', async ({ baseURL }) => {
22
24
) ;
23
25
} ) ;
24
26
25
- await fetch ( `${ baseURL } /test-transaction` ) ;
27
+ fetch ( `${ baseURL } /test-transaction` ) ;
26
28
27
29
const otelData = await otelPromise ;
28
30
@@ -38,7 +40,9 @@ test('Sends an API route transaction to OTLP', async ({ baseURL }) => {
38
40
// But our default node-fetch spans are not emitted
39
41
expect ( scopeSpans . length ) . toEqual ( 2 ) ;
40
42
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
+ ) ;
42
46
const undiciScopes = scopeSpans ?. filter (
43
47
scopeSpan => scopeSpan . scope . name === '@opentelemetry/instrumentation-undici' ,
44
48
) ;
@@ -49,6 +53,38 @@ test('Sends an API route transaction to OTLP', async ({ baseURL }) => {
49
53
expect ( undiciScopes . length ) . toBe ( 1 ) ;
50
54
expect ( undiciScopes [ 0 ] . spans . length ) . toBe ( 1 ) ;
51
55
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
+
52
88
// There may be another span from another request, we can ignore that
53
89
const httpSpans = httpScopes [ 0 ] . spans . filter ( span =>
54
90
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 }) => {
62
98
kind : 2 ,
63
99
startTimeUnixNano : expect . any ( String ) ,
64
100
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
+ ] ) ,
163
119
droppedAttributesCount : 0 ,
164
120
events : [ ] ,
165
121
droppedEventsCount : 0 ,
0 commit comments