Package Exports
- @opentelemetry/context-async-hooks
- @opentelemetry/context-async-hooks/build/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@opentelemetry/context-async-hooks) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
OpenTelemetry async_hooks-based Context Managers
This package provides two ContextManager implementations built on APIs from Node.js's [async_hooks][async-hooks-doc] module. If you're looking for a ContextManager to use in browser environments, consider opentelemetry-context-zone or opentelemetry-context-zone-peer-dep.
See the definition of the ContextManager interface and the problem it solves.
API
Two ContextManager implementations are exported:
AsyncLocalStorageContextManager, based onAsyncLocalStorageAsyncHooksContextManager, based onAsyncHook. This is deprecated and will be removed in v3 (planned for mid-2025.AsyncLocalStorageis simpler, faster, available in Node.js v14.8.0 and later, and avoids this possible DoS vulnerability.
Prior art
Context propagation is a big subject when talking about tracing in Node.js. If you want more information about it here are some resources:
- https://www.npmjs.com/package/continuation-local-storage (which was the old way of doing context propagation)
- Datadog's own implementation for their JavaScript tracer
- OpenTracing implementation
- Discussion about context propagation by the Node.js Diagnostics Working Group
Useful links
- For more information on OpenTelemetry, visit: https://opentelemetry.io/
- For more about OpenTelemetry JavaScript: https://github.com/open-telemetry/opentelemetry-js
- For help or feedback on this project, join us in GitHub Discussions
License
Apache 2.0 - See LICENSE for more information.