diff --git a/metapackages/auto-instrumentations-node/src/register.ts b/metapackages/auto-instrumentations-node/src/register.ts index a14538da66..5b57d45d0a 100644 --- a/metapackages/auto-instrumentations-node/src/register.ts +++ b/metapackages/auto-instrumentations-node/src/register.ts @@ -25,8 +25,17 @@ diag.setLogger( opentelemetry.core.getEnv().OTEL_LOG_LEVEL ); +const disabledAutoinstrumentations = ( + process.env.OTEL_DISABLED_AUTOINSTRUMENTATIONS ?? '' +).split(','); + const sdk = new opentelemetry.NodeSDK({ - instrumentations: getNodeAutoInstrumentations(), + instrumentations: getNodeAutoInstrumentations( + Object.fromEntries( + disabledAutoinstrumentations.map(instrumentationName => + [instrumentationName, { enabled: false }] + )) + ), resourceDetectors: getResourceDetectorsFromEnv(), });