@@ -3,11 +3,6 @@ import { Span } from '@sentry/types';
33import axios from 'axios' ;
44import { waitForTransaction } from '../event-proxy-server' ;
55
6- const authToken = process . env . E2E_TEST_AUTH_TOKEN ;
7- const sentryTestOrgSlug = process . env . E2E_TEST_SENTRY_ORG_SLUG ;
8- const sentryTestProject = process . env . E2E_TEST_SENTRY_TEST_PROJECT ;
9- const EVENT_POLLING_TIMEOUT = 90_000 ;
10-
116test ( 'Propagates trace for outgoing http requests' , async ( { baseURL } ) => {
127 const inboundTransactionPromise = waitForTransaction ( 'node-experimental-fastify-app' , transactionEvent => {
138 return (
@@ -55,73 +50,77 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
5550 ] ) ,
5651 ) ;
5752
58- expect ( outboundTransaction ) . toEqual (
59- expect . objectContaining ( {
60- contexts : expect . objectContaining ( {
61- trace : {
62- data : {
63- 'http.flavor' : '1.1' ,
64- 'http.host' : 'localhost:3030' ,
65- 'http.method' : 'GET' ,
66- 'http.response.status_code' : 200 ,
67- 'http.route' : '/test-outgoing-http' ,
68- 'http.scheme' : 'http' ,
69- 'http.status_code' : 200 ,
70- 'http.status_text' : 'OK' ,
71- 'http.target' : '/test-outgoing-http' ,
72- 'http.url' : 'http://localhost:3030/test-outgoing-http' ,
73- 'http.user_agent' : 'axios/1.6.7' ,
74- 'net.host.ip' : '::1' ,
75- 'net.host.name' : 'localhost' ,
76- 'net.host.port' : 3030 ,
77- 'net.peer.ip' : '::1' ,
78- 'net.peer.port' : 35152 ,
79- 'net.transport' : 'ip_tcp' ,
80- 'otel.kind' : 'SERVER' ,
81- 'sentry.op' : 'http.server' ,
82- 'sentry.origin' : 'auto.http.otel.http' ,
83- 'sentry.sample_rate' : 1 ,
84- 'sentry.source' : 'route' ,
85- url : 'http://localhost:3030/test-outgoing-http' ,
86- } ,
87- op : 'http.server' ,
88- span_id : expect . any ( String ) ,
89- status : 'ok' ,
90- tags : {
91- 'http.status_code' : '200' ,
92- } ,
93- trace_id : traceId ,
94- origin : 'auto.http.otel.http' ,
95- } ,
96- } ) ,
97- } ) ,
98- ) ;
53+ expect ( outboundTransaction . contexts ?. trace ) . toEqual ( {
54+ data : {
55+ 'sentry.source' : 'route' ,
56+ 'sentry.origin' : 'auto.http.otel.http' ,
57+ 'sentry.op' : 'http.server' ,
58+ 'sentry.sample_rate' : 1 ,
59+ url : 'http://localhost:3030/test-outgoing-http' ,
60+ 'otel.kind' : 'SERVER' ,
61+ 'http.response.status_code' : 200 ,
62+ 'http.url' : 'http://localhost:3030/test-outgoing-http' ,
63+ 'http.host' : 'localhost:3030' ,
64+ 'net.host.name' : 'localhost' ,
65+ 'http.method' : 'GET' ,
66+ 'http.scheme' : 'http' ,
67+ 'http.target' : '/test-outgoing-http' ,
68+ 'http.user_agent' : 'axios/1.6.7' ,
69+ 'http.flavor' : '1.1' ,
70+ 'net.transport' : 'ip_tcp' ,
71+ 'net.host.ip' : '127.0.0.1' ,
72+ 'net.host.port' : expect . any ( Number ) ,
73+ 'net.peer.ip' : '127.0.0.1' ,
74+ 'net.peer.port' : expect . any ( Number ) ,
75+ 'http.status_code' : 200 ,
76+ 'http.status_text' : 'OK' ,
77+ 'http.route' : '/test-outgoing-http' ,
78+ } ,
79+ op : 'http.server' ,
80+ span_id : expect . any ( String ) ,
81+ status : 'ok' ,
82+ tags : {
83+ 'http.status_code' : '200' ,
84+ } ,
85+ trace_id : traceId ,
86+ origin : 'auto.http.otel.http' ,
87+ } ) ;
9988
100- expect ( inboundTransaction ) . toEqual (
101- expect . objectContaining ( {
102- contexts : expect . objectContaining ( {
103- trace : {
104- data : {
105- url : 'http://localhost:3030/test-inbound-headers' ,
106- 'otel.kind' : 'SERVER' ,
107- 'http.response.status_code' : 200 ,
108- 'sentry.op' : 'http.server' ,
109- 'sentry.origin' : 'auto.http.otel.http' ,
110- 'sentry.source' : 'route' ,
111- } ,
112- op : 'http.server' ,
113- parent_span_id : outgoingHttpSpanId ,
114- span_id : expect . any ( String ) ,
115- status : 'ok' ,
116- tags : {
117- 'http.status_code' : '200' ,
118- } ,
119- trace_id : traceId ,
120- origin : 'auto.http.otel.http' ,
121- } ,
122- } ) ,
123- } ) ,
124- ) ;
89+ expect ( inboundTransaction . contexts ?. trace ) . toEqual ( {
90+ data : {
91+ 'sentry.source' : 'route' ,
92+ 'sentry.origin' : 'auto.http.otel.http' ,
93+ 'sentry.op' : 'http.server' ,
94+ 'sentry.sample_rate' : 1 ,
95+ url : 'http://localhost:3030/test-inbound-headers' ,
96+ 'otel.kind' : 'SERVER' ,
97+ 'http.response.status_code' : 200 ,
98+ 'http.url' : 'http://localhost:3030/test-inbound-headers' ,
99+ 'http.host' : 'localhost:3030' ,
100+ 'net.host.name' : 'localhost' ,
101+ 'http.method' : 'GET' ,
102+ 'http.scheme' : 'http' ,
103+ 'http.target' : '/test-inbound-headers' ,
104+ 'http.flavor' : '1.1' ,
105+ 'net.transport' : 'ip_tcp' ,
106+ 'net.host.ip' : '127.0.0.1' ,
107+ 'net.host.port' : expect . any ( Number ) ,
108+ 'net.peer.ip' : '127.0.0.1' ,
109+ 'net.peer.port' : expect . any ( Number ) ,
110+ 'http.status_code' : 200 ,
111+ 'http.status_text' : 'OK' ,
112+ 'http.route' : '/test-inbound-headers' ,
113+ } ,
114+ op : 'http.server' ,
115+ parent_span_id : outgoingHttpSpanId ,
116+ span_id : expect . any ( String ) ,
117+ status : 'ok' ,
118+ tags : {
119+ 'http.status_code' : '200' ,
120+ } ,
121+ trace_id : traceId ,
122+ origin : 'auto.http.otel.http' ,
123+ } ) ;
125124} ) ;
126125
127126test ( 'Propagates trace for outgoing fetch requests' , async ( { baseURL } ) => {
@@ -171,71 +170,75 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => {
171170 ] ) ,
172171 ) ;
173172
174- expect ( outboundTransaction ) . toEqual (
175- expect . objectContaining ( {
176- contexts : expect . objectContaining ( {
177- trace : {
178- data : {
179- 'http.flavor' : '1.1' ,
180- 'http.host' : 'localhost:3030' ,
181- 'http.method' : 'GET' ,
182- 'http.response.status_code' : 200 ,
183- 'http.route' : '/test-outgoing-fetch' ,
184- 'http.scheme' : 'http' ,
185- 'http.status_code' : 200 ,
186- 'http.status_text' : 'OK' ,
187- 'http.target' : '/test-outgoing-fetch' ,
188- 'http.url' : 'http://localhost:3030/test-outgoing-fetch' ,
189- 'http.user_agent' : 'axios/1.6.7' ,
190- 'net.host.ip' : '::1' ,
191- 'net.host.name' : 'localhost' ,
192- 'net.host.port' : 3030 ,
193- 'net.peer.ip' : '::1' ,
194- 'net.peer.port' : 40084 ,
195- 'net.transport' : 'ip_tcp' ,
196- 'otel.kind' : 'SERVER' ,
197- 'sentry.op' : 'http.server' ,
198- 'sentry.origin' : 'auto.http.otel.http' ,
199- 'sentry.sample_rate' : 1 ,
200- 'sentry.source' : 'route' ,
201- url : 'http://localhost:3030/test-outgoing-fetch' ,
202- } ,
203- op : 'http.server' ,
204- span_id : expect . any ( String ) ,
205- status : 'ok' ,
206- tags : {
207- 'http.status_code' : '200' ,
208- } ,
209- trace_id : traceId ,
210- origin : 'auto.http.otel.http' ,
211- } ,
212- } ) ,
213- } ) ,
214- ) ;
173+ expect ( outboundTransaction . contexts ?. trace ) . toEqual ( {
174+ data : {
175+ 'sentry.source' : 'route' ,
176+ 'sentry.origin' : 'auto.http.otel.http' ,
177+ 'sentry.op' : 'http.server' ,
178+ 'sentry.sample_rate' : 1 ,
179+ url : 'http://localhost:3030/test-outgoing-fetch' ,
180+ 'otel.kind' : 'SERVER' ,
181+ 'http.response.status_code' : 200 ,
182+ 'http.url' : 'http://localhost:3030/test-outgoing-fetch' ,
183+ 'http.host' : 'localhost:3030' ,
184+ 'net.host.name' : 'localhost' ,
185+ 'http.method' : 'GET' ,
186+ 'http.scheme' : 'http' ,
187+ 'http.target' : '/test-outgoing-http' ,
188+ 'http.user_agent' : 'axios/1.6.7' ,
189+ 'http.flavor' : '1.1' ,
190+ 'net.transport' : 'ip_tcp' ,
191+ 'net.host.ip' : '127.0.0.1' ,
192+ 'net.host.port' : expect . any ( Number ) ,
193+ 'net.peer.ip' : '127.0.0.1' ,
194+ 'net.peer.port' : expect . any ( Number ) ,
195+ 'http.status_code' : 200 ,
196+ 'http.status_text' : 'OK' ,
197+ 'http.route' : '/test-outgoing-fetch' ,
198+ } ,
199+ op : 'http.server' ,
200+ span_id : expect . any ( String ) ,
201+ status : 'ok' ,
202+ tags : {
203+ 'http.status_code' : '200' ,
204+ } ,
205+ trace_id : traceId ,
206+ origin : 'auto.http.otel.http' ,
207+ } ) ;
215208
216- expect ( inboundTransaction ) . toEqual (
217- expect . objectContaining ( {
218- contexts : expect . objectContaining ( {
219- trace : {
220- data : {
221- url : 'http://localhost:3030/test-inbound-headers' ,
222- 'otel.kind' : 'SERVER' ,
223- 'http.response.status_code' : 200 ,
224- 'sentry.op' : 'http.server' ,
225- 'sentry.origin' : 'auto.http.otel.http' ,
226- 'sentry.source' : 'route' ,
227- } ,
228- op : 'http.server' ,
229- parent_span_id : outgoingHttpSpanId ,
230- span_id : expect . any ( String ) ,
231- status : 'ok' ,
232- tags : {
233- 'http.status_code' : '200' ,
234- } ,
235- trace_id : traceId ,
236- origin : 'auto.http.otel.http' ,
237- } ,
238- } ) ,
239- } ) ,
240- ) ;
209+ expect ( inboundTransaction . contexts ?. trace ) . toEqual ( {
210+ data : {
211+ 'sentry.source' : 'route' ,
212+ 'sentry.origin' : 'auto.http.otel.http' ,
213+ 'sentry.op' : 'http.server' ,
214+ 'sentry.sample_rate' : 1 ,
215+ url : 'http://localhost:3030/test-inbound-headers' ,
216+ 'otel.kind' : 'SERVER' ,
217+ 'http.response.status_code' : 200 ,
218+ 'http.url' : 'http://localhost:3030/test-inbound-headers' ,
219+ 'http.host' : 'localhost:3030' ,
220+ 'net.host.name' : 'localhost' ,
221+ 'http.method' : 'GET' ,
222+ 'http.scheme' : 'http' ,
223+ 'http.target' : '/test-inbound-headers' ,
224+ 'http.flavor' : '1.1' ,
225+ 'net.transport' : 'ip_tcp' ,
226+ 'net.host.ip' : '127.0.0.1' ,
227+ 'net.host.port' : expect . any ( Number ) ,
228+ 'net.peer.ip' : '127.0.0.1' ,
229+ 'net.peer.port' : expect . any ( Number ) ,
230+ 'http.status_code' : 200 ,
231+ 'http.status_text' : 'OK' ,
232+ 'http.route' : '/test-inbound-headers' ,
233+ } ,
234+ op : 'http.server' ,
235+ parent_span_id : outgoingHttpSpanId ,
236+ span_id : expect . any ( String ) ,
237+ status : 'ok' ,
238+ tags : {
239+ 'http.status_code' : '200' ,
240+ } ,
241+ trace_id : traceId ,
242+ origin : 'auto.http.otel.http' ,
243+ } ) ;
241244} ) ;
0 commit comments