From ad5ec3092faf523f7c914daaf49de05119add7b6 Mon Sep 17 00:00:00 2001 From: Jackson Weber Date: Tue, 16 Jan 2024 14:47:06 -0800 Subject: [PATCH] Clean up tracerProvider logic. --- .../opentelemetry-sdk-node/src/sdk.ts | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/experimental/packages/opentelemetry-sdk-node/src/sdk.ts b/experimental/packages/opentelemetry-sdk-node/src/sdk.ts index 218d8bb8ca3..c44521163f9 100644 --- a/experimental/packages/opentelemetry-sdk-node/src/sdk.ts +++ b/experimental/packages/opentelemetry-sdk-node/src/sdk.ts @@ -325,23 +325,11 @@ export class NodeSDK { ? NodeTracerProvider : TracerProviderWithEnvExporters; - let tracerProvider; - - // If the Provider is configured with Env Exporters, we need to check if the SDK had any manual configurations, else configure normally - if ( - typeof Provider === typeof TracerProviderWithEnvExporters && - this._configuration - ) { - tracerProvider = new Provider({ - ...this._configuration, - resource: this._resource, - }); - } else { - tracerProvider = new Provider({ - ...this._tracerProviderConfig?.tracerConfig, - resource: this._resource, - }); - } + // If the Provider is configured with Env Exporters, we need to check if the SDK had any manual configurations and set them here + const tracerProvider = new Provider({ + ...this._configuration, + resource: this._resource, + }); this._tracerProvider = tracerProvider;