diff --git a/nodejs/packages/layer/package.json b/nodejs/packages/layer/package.json index 14153a26b2..899de06cb3 100644 --- a/nodejs/packages/layer/package.json +++ b/nodejs/packages/layer/package.json @@ -28,8 +28,9 @@ }, "dependencies": { "@opentelemetry/api": "^1.7.0", - "@opentelemetry/exporter-trace-otlp-proto": "^0.52.1", + "@opentelemetry/auto-configuration-propagators": "^0.2.0", "@opentelemetry/exporter-metrics-otlp-proto": "^0.52.1", + "@opentelemetry/exporter-trace-otlp-proto": "^0.52.1", "@opentelemetry/instrumentation": "^0.52.1", "@opentelemetry/instrumentation-aws-lambda": "^0.43.0", "@opentelemetry/instrumentation-aws-sdk": "^0.43.0", diff --git a/nodejs/packages/layer/src/wrapper.ts b/nodejs/packages/layer/src/wrapper.ts index 26f9b5d71d..1cc8bf6fbd 100644 --- a/nodejs/packages/layer/src/wrapper.ts +++ b/nodejs/packages/layer/src/wrapper.ts @@ -23,6 +23,7 @@ import { getEnv } from '@opentelemetry/core'; import { AwsLambdaInstrumentationConfig } from '@opentelemetry/instrumentation-aws-lambda'; import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto'; import { MeterProvider, MeterProviderOptions } from '@opentelemetry/sdk-metrics'; +import { getPropagator } from '@opentelemetry/auto-configuration-propagators'; function defaultConfigureInstrumentations() { // Use require statements for instrumentation to avoid having to have transitive dependencies on all the typescript @@ -121,6 +122,10 @@ async function initializeProvider() { if (typeof configureSdkRegistration === 'function') { sdkRegistrationConfig = configureSdkRegistration(sdkRegistrationConfig); } + // auto-configure propagator if not provided + if (!sdkRegistrationConfig.propagator) { + sdkRegistrationConfig.propagator = getPropagator(); + } tracerProvider.register(sdkRegistrationConfig); // Configure default meter provider (doesn't export metrics)