File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
packages/core/src/telemetry Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -110,13 +110,13 @@ describe('Telemetry SDK', () => {
110110 await initializeTelemetry ( mockConfig ) ;
111111
112112 expect ( OTLPTraceExporterHttp ) . toHaveBeenCalledWith ( {
113- url : 'http://localhost:4318/' ,
113+ url : 'http://localhost:4318/v1/traces ' ,
114114 } ) ;
115115 expect ( OTLPLogExporterHttp ) . toHaveBeenCalledWith ( {
116- url : 'http://localhost:4318/' ,
116+ url : 'http://localhost:4318/v1/logs ' ,
117117 } ) ;
118118 expect ( OTLPMetricExporterHttp ) . toHaveBeenCalledWith ( {
119- url : 'http://localhost:4318/' ,
119+ url : 'http://localhost:4318/v1/metrics ' ,
120120 } ) ;
121121 expect ( NodeSDK . prototype . start ) . toHaveBeenCalled ( ) ;
122122 } ) ;
@@ -138,7 +138,7 @@ describe('Telemetry SDK', () => {
138138 ) ;
139139 await initializeTelemetry ( mockConfig ) ;
140140 expect ( OTLPTraceExporterHttp ) . toHaveBeenCalledWith (
141- expect . objectContaining ( { url : 'https://my-collector.com/' } ) ,
141+ expect . objectContaining ( { url : 'https://my-collector.com/v1/traces ' } ) ,
142142 ) ;
143143 } ) ;
144144
Original file line number Diff line number Diff line change @@ -240,15 +240,17 @@ export async function initializeTelemetry(
240240 } ) ;
241241 } else if ( useOtlp ) {
242242 if ( otlpProtocol === 'http' ) {
243+ // Trim trailing slashes
244+ const baseUrl = parsedEndpoint . replace ( / \/ + $ / , '' ) ;
243245 spanExporter = new OTLPTraceExporterHttp ( {
244- url : parsedEndpoint ,
246+ url : ` ${ baseUrl } /v1/traces` ,
245247 } ) ;
246248 logExporter = new OTLPLogExporterHttp ( {
247- url : parsedEndpoint ,
249+ url : ` ${ baseUrl } /v1/logs` ,
248250 } ) ;
249251 metricReader = new PeriodicExportingMetricReader ( {
250252 exporter : new OTLPMetricExporterHttp ( {
251- url : parsedEndpoint ,
253+ url : ` ${ baseUrl } /v1/metrics` ,
252254 } ) ,
253255 exportIntervalMillis : 10000 ,
254256 } ) ;
You can’t perform that action at this time.
0 commit comments