Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/core/src/telemetry/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ describe('Telemetry SDK', () => {
await initializeTelemetry(mockConfig);

expect(OTLPTraceExporterHttp).toHaveBeenCalledWith({
url: 'http://localhost:4318/',
url: 'http://localhost:4318/v1/traces',
});
expect(OTLPLogExporterHttp).toHaveBeenCalledWith({
url: 'http://localhost:4318/',
url: 'http://localhost:4318/v1/logs',
});
expect(OTLPMetricExporterHttp).toHaveBeenCalledWith({
url: 'http://localhost:4318/',
url: 'http://localhost:4318/v1/metrics',
});
expect(NodeSDK.prototype.start).toHaveBeenCalled();
});
Expand All @@ -138,7 +138,7 @@ describe('Telemetry SDK', () => {
);
await initializeTelemetry(mockConfig);
expect(OTLPTraceExporterHttp).toHaveBeenCalledWith(
expect.objectContaining({ url: 'https://my-collector.com/' }),
expect.objectContaining({ url: 'https://my-collector.com/v1/traces' }),
);
});

Expand Down
8 changes: 5 additions & 3 deletions packages/core/src/telemetry/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,17 @@ export async function initializeTelemetry(
});
} else if (useOtlp) {
if (otlpProtocol === 'http') {
// Trim trailing slashes
const baseUrl = parsedEndpoint.replace(/\/+$/, '');
spanExporter = new OTLPTraceExporterHttp({
url: parsedEndpoint,
url: `${baseUrl}/v1/traces`,
});
logExporter = new OTLPLogExporterHttp({
url: parsedEndpoint,
url: `${baseUrl}/v1/logs`,
});
metricReader = new PeriodicExportingMetricReader({
exporter: new OTLPMetricExporterHttp({
url: parsedEndpoint,
url: `${baseUrl}/v1/metrics`,
}),
exportIntervalMillis: 10000,
});
Expand Down