OpenTelemetry AsyncHooks-based Scope Manager
$ cnpm install @opentelemetry/scope-async-hooks
This package provides async-hooks based scope manager which is used internally by OpenTelemetry plugins to propagate specific scope between function calls and async operations. It only targets NodeJS since async-hooks is only available there.
The definition and why they exist is available on the readme of the scope-base package.
NodeJS has a specific API to track async scope: async-hooks, it allows to track creation of new async operation and their respective parent. This package only handle storing a specific object for a given async hooks context.
Even if the API is native to NodeJS, it doesn't cover all possible cases of scope propagation but there is a big effort from the NodeJS team to fix those. That's why we generally advise to be on the latest LTS to benefit from performance and bug fixes.
There are known modules that break scope propagation (some of them are listed there), so it's possible that the scope manager doesn't work with them.
Context propagation is a big subject when talking about tracing in NodeJS, if you want more information about that here are some resources:
Apache 2.0 - See LICENSE for more information.
Copyright 2013 - present © cnpmjs.org | Home |