fix(instrumentation): open telemetry init (#1426)

This commit is contained in:
Vikhyath Mondreti
2025-09-23 11:06:40 -07:00
committed by GitHub
parent 6d1b172a3e
commit dd8f633f9f
+1 -17
View File
@@ -50,28 +50,12 @@ async function initializeOpenTelemetry() {
const { NodeSDK } = await import('@opentelemetry/sdk-node')
const { resourceFromAttributes } = await import('@opentelemetry/resources')
const { SemanticResourceAttributes } = await import('@opentelemetry/semantic-conventions')
const { BatchSpanProcessor } = await import('@opentelemetry/sdk-trace-node')
const { OTLPTraceExporter } = await import('@opentelemetry/exporter-trace-otlp-http')
const exporter = new OTLPTraceExporter({
url: telemetryConfig.endpoint,
})
const spanProcessor = new BatchSpanProcessor(exporter, {
maxQueueSize:
telemetryConfig.batchSettings?.maxQueueSize ||
DEFAULT_TELEMETRY_CONFIG.batchSettings.maxQueueSize,
maxExportBatchSize:
telemetryConfig.batchSettings?.maxExportBatchSize ||
DEFAULT_TELEMETRY_CONFIG.batchSettings.maxExportBatchSize,
scheduledDelayMillis:
telemetryConfig.batchSettings?.scheduledDelayMillis ||
DEFAULT_TELEMETRY_CONFIG.batchSettings.scheduledDelayMillis,
exportTimeoutMillis:
telemetryConfig.batchSettings?.exportTimeoutMillis ||
DEFAULT_TELEMETRY_CONFIG.batchSettings.exportTimeoutMillis,
})
const configResource = resourceFromAttributes({
[SemanticResourceAttributes.SERVICE_NAME]: telemetryConfig.serviceName,
[SemanticResourceAttributes.SERVICE_VERSION]: telemetryConfig.serviceVersion,
@@ -80,7 +64,7 @@ async function initializeOpenTelemetry() {
const sdk = new NodeSDK({
resource: configResource,
spanProcessors: [spanProcessor],
traceExporter: exporter,
})
sdk.start()