
Security News
Feross on TBPN: Socket's Series C and the State of Software Supply Chain Security
Feross Aboukhadijeh joins TBPN to discuss Socket's $60M Series C, 500%+ ARR growth, AI's impact on open source, and the rise in supply chain attacks.
@opentelemetry/context-async-hooks
Advanced tools
This package provides two ContextManager implementations built on APIs from Node.js's async_hooks 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.
Two ContextManager implementations are exported:
AsyncLocalStorageContextManager, based on AsyncLocalStorageAsyncHooksContextManager, based on AsyncHookThe former should be preferred over the latter as its implementation is substantially simpler than the latter's, and according to Node.js docs,
While you can create your own implementation [of
AsyncLocalStorage] on top of [AsyncHook],AsyncLocalStorageshould be preferred as it is a performant and memory safe implementation that involves significant optimizations that are non-obvious to implement.
AsyncLocalStorage is available in node ^12.17.0 || >= 13.10.0, however AsyncLocalStorageContextManager is not enabled by default for node <14.8.0 because of some important bugfixes which were introduced in v14.8.0 (e.g., nodejs/node#34573).
It's possible that this package won't track context perfectly when used with certain packages. In particular, it inherits any bugs present in async_hooks. See the known issues.
async_hooks is still seeing significant correctness and performance fixes, it's recommended to run the latest Node.js LTS release to benefit from said fixes.
Context propagation is a big subject when talking about tracing in Node.js. If you want more information about it here are some resources:
Apache 2.0 - See LICENSE for more information.
FAQs
OpenTelemetry AsyncLocalStorage-based Context Manager
The npm package @opentelemetry/context-async-hooks receives a total of 24,717,982 weekly downloads. As such, @opentelemetry/context-async-hooks popularity was classified as popular.
We found that @opentelemetry/context-async-hooks demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Feross Aboukhadijeh joins TBPN to discuss Socket's $60M Series C, 500%+ ARR growth, AI's impact on open source, and the rise in supply chain attacks.

Security News
OSV withdrew 157 OSV malware reports after automated false positives incorrectly flagged trusted npm and PyPI packages, sending bad records into tools that rely on OSV data.

Research
/Security News
TrapDoor crypto stealer hits 36 malicious packages across npm, PyPI, and Crates.io, targeting crypto, DeFi, AI, and security developers.