Refactor OpenTelemetry configuration

This commit is contained in:
Simon Larsen 2024-02-20 13:01:58 +00:00
parent fb7fe8af1e
commit 30d9cbe9a3
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE

View File

@ -24,14 +24,18 @@ if (
}
}
const otlpEndpoint = process.env['OTEL_EXPORTER_OTLP_ENDPOINT'];
logger.info(otlpEndpoint);
sdk = new opentelemetry.NodeSDK({
traceExporter: new OTLPTraceExporter({
url: process.env['OTEL_EXPORTER_OTLP_ENDPOINT'],
url: otlpEndpoint + '/v1/traces',
headers: headers,
}),
metricReader: new PeriodicExportingMetricReader({
exporter: new OTLPMetricExporter({
url: process.env['OTEL_EXPORTER_OTLP_ENDPOINT'],
url: otlpEndpoint + '/v1/metrics',
headers: headers,
}),
}) as any,