1
- import type { Client , Integration } from '@sentry/types' ;
1
+ import type { Client , Envelope , Integration } from '@sentry/types' ;
2
2
import { logger , serializeEnvelope } from '@sentry/utils' ;
3
3
import * as http from 'http' ;
4
4
import { URL } from 'url' ;
5
5
6
6
type SpotlightConnectionOptions = {
7
7
/**
8
8
* Set this if the Spotlight Sidecar is not running on localhost:8969
9
- * By default, the Url is set to http://localhost:8969
9
+ * By default, the Url is set to http://localhost:8969/stream
10
10
*/
11
11
sidecarUrl ?: string ;
12
12
} ;
@@ -26,7 +26,7 @@ export class Spotlight implements Integration {
26
26
27
27
public constructor ( options ?: SpotlightConnectionOptions ) {
28
28
this . _options = {
29
- sidecarUrl : options ?. sidecarUrl || 'http://localhost:8969' ,
29
+ sidecarUrl : options ?. sidecarUrl || 'http://localhost:8969/stream ' ,
30
30
} ;
31
31
}
32
32
@@ -61,7 +61,7 @@ function connectToSpotlight(client: Client, options: Required<SpotlightConnectio
61
61
return ;
62
62
}
63
63
64
- client . on ( 'beforeEnvelope' , envelope => {
64
+ client . on ( 'beforeEnvelope' , ( envelope : Envelope ) => {
65
65
if ( failedRequests > 3 ) {
66
66
logger . warn ( '[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests' ) ;
67
67
return ;
@@ -72,7 +72,7 @@ function connectToSpotlight(client: Client, options: Required<SpotlightConnectio
72
72
const req = http . request (
73
73
{
74
74
method : 'POST' ,
75
- path : '/stream' ,
75
+ path : spotlightUrl . pathname ,
76
76
hostname : spotlightUrl . hostname ,
77
77
port : spotlightUrl . port ,
78
78
headers : {
@@ -102,7 +102,7 @@ function connectToSpotlight(client: Client, options: Required<SpotlightConnectio
102
102
103
103
function parseSidecarUrl ( url : string ) : URL | undefined {
104
104
try {
105
- return new URL ( `${ url } /stream ` ) ;
105
+ return new URL ( `${ url } ` ) ;
106
106
} catch {
107
107
logger . warn ( `[Spotlight] Invalid sidecar URL: ${ url } ` ) ;
108
108
return undefined ;
0 commit comments