File tree Expand file tree Collapse file tree 2 files changed +42
-10
lines changed
dev-packages/node-integration-tests/suites/tracing Expand file tree Collapse file tree 2 files changed +42
-10
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,25 @@ Sentry.init({
12
12
13
13
import * as http from 'http' ;
14
14
15
- Sentry . startSpan ( { name : 'test_span' } , ( ) => {
16
- http . get ( `${ process . env . SERVER_URL } /api/v0` ) ;
17
- http . get ( `${ process . env . SERVER_URL } /api/v1` ) ;
18
- http . get ( `${ process . env . SERVER_URL } /api/v2` ) ;
19
- http . get ( `${ process . env . SERVER_URL } /api/v3` ) ;
15
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
16
+ Sentry . startSpan ( { name : 'test_span' } , async ( ) => {
17
+ await makeHttpRequest ( `${ process . env . SERVER_URL } /api/v0` ) ;
18
+ await makeHttpRequest ( `${ process . env . SERVER_URL } /api/v1` ) ;
19
+ await makeHttpRequest ( `${ process . env . SERVER_URL } /api/v2` ) ;
20
+ await makeHttpRequest ( `${ process . env . SERVER_URL } /api/v3` ) ;
20
21
} ) ;
22
+
23
+ function makeHttpRequest ( url : string ) : Promise < void > {
24
+ return new Promise < void > ( resolve => {
25
+ http
26
+ . request ( url , httpRes => {
27
+ httpRes . on ( 'data' , ( ) => {
28
+ // we don't care about data
29
+ } ) ;
30
+ httpRes . on ( 'end' , ( ) => {
31
+ resolve ( ) ;
32
+ } ) ;
33
+ } )
34
+ . end ( ) ;
35
+ } ) ;
36
+ }
Original file line number Diff line number Diff line change @@ -12,9 +12,25 @@ Sentry.init({
12
12
13
13
import * as http from 'http' ;
14
14
15
- Sentry . startSpan ( { name : 'test_span' } , ( ) => {
16
- http . get ( `${ process . env . SERVER_URL } /api/v0` ) ;
17
- http . get ( `${ process . env . SERVER_URL } /api/v1` ) ;
18
- http . get ( `${ process . env . SERVER_URL } /api/v2` ) ;
19
- http . get ( `${ process . env . SERVER_URL } /api/v3` ) ;
15
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
16
+ Sentry . startSpan ( { name : 'test_span' } , async ( ) => {
17
+ await makeHttpRequest ( `${ process . env . SERVER_URL } /api/v0` ) ;
18
+ await makeHttpRequest ( `${ process . env . SERVER_URL } /api/v1` ) ;
19
+ await makeHttpRequest ( `${ process . env . SERVER_URL } /api/v2` ) ;
20
+ await makeHttpRequest ( `${ process . env . SERVER_URL } /api/v3` ) ;
20
21
} ) ;
22
+
23
+ function makeHttpRequest ( url : string ) : Promise < void > {
24
+ return new Promise < void > ( resolve => {
25
+ http
26
+ . request ( url , httpRes => {
27
+ httpRes . on ( 'data' , ( ) => {
28
+ // we don't care about data
29
+ } ) ;
30
+ httpRes . on ( 'end' , ( ) => {
31
+ resolve ( ) ;
32
+ } ) ;
33
+ } )
34
+ . end ( ) ;
35
+ } ) ;
36
+ }
You can’t perform that action at this time.
0 commit comments