Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix context manager for older node versions #53

Merged
merged 1 commit into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
4 changes: 3 additions & 1 deletion src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export function startTracing(opts: Partial<Options> = {}): 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);
Expand Down