Skip to content

Commit

Permalink
fix(sdk-node): Fix logic for creating tracerProviders.
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonWeber committed Dec 29, 2023
1 parent 306e08d commit 7eca942
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions experimental/packages/opentelemetry-sdk-node/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export class NodeSDK {
public constructor(configuration: Partial<NodeSDKConfiguration> = {}) {
const env = getEnv();
const envWithoutDefaults = getEnvWithoutDefaults();
const envExporterWithConfiguration = env.OTEL_TRACES_EXPORTER && (configuration.sampler || configuration.spanLimits || configuration.idGenerator);

if (env.OTEL_SDK_DISABLED) {
this._disabled = true;
Expand All @@ -126,11 +127,8 @@ export class NodeSDK {

this._autoDetectResources = configuration.autoDetectResources ?? true;

if (
configuration.spanProcessor ||
configuration.traceExporter ||
(env.OTEL_TRACES_EXPORTER && env.OTEL_TRACES_EXPORTER !== 'none')
) {
// If there are configuration options to read, we need to create a new TracerProvider even if the exporter is configured in the environment
if ((configuration.traceExporter || configuration.spanProcessor) || envExporterWithConfiguration) {
const tracerProviderConfig: NodeTracerConfig = {};

if (configuration.sampler) {
Expand Down

0 comments on commit 7eca942

Please sign in to comment.