diff --git a/CHANGELOG.md b/CHANGELOG.md index 8990b79f..e9539e72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +### Changed + +- Context management should not work properly on older versions of NodeJS (<14.8). + ([#53](https://github.com/signalfx/splunk-otel-js/pull/53)) + + ## 0.5.0 (03-24-2021) - Replaced `SPLUNK_TRACE_EXPORTER_URL` with `OTEL_EXPORTER_JAEGER_ENDPOINT`. diff --git a/src/tracing.ts b/src/tracing.ts index 627b8a77..cde20c62 100644 --- a/src/tracing.ts +++ b/src/tracing.ts @@ -42,7 +42,9 @@ export function startTracing(opts: Partial = {}): void { const ContextManager = gte(process.version, '14.8.0') ? AsyncLocalStorageContextManager : AsyncHooksContextManager; - context.setGlobalContextManager(new ContextManager()); + const contextManager = new ContextManager(); + contextManager.enable(); + context.setGlobalContextManager(contextManager); // tracer provider const provider = new NodeTracerProvider(options.tracerConfig);