{"name":"@opentelemetry/context-async-hooks","version":"1.11.0","description":"OpenTelemetry AsyncHooks-based Context Manager","main":"build/src/index.js","types":"build/src/index.d.ts","repository":{"type":"git","url":"git+https://github.com/open-telemetry/opentelemetry-js.git"},"scripts":{"prepublishOnly":"npm run compile","compile":"tsc --build","clean":"tsc --build --clean","test":"nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'","tdd":"npm run test -- --watch-extensions ts --watch","codecov":"nyc report --reporter=json && codecov -f coverage/*.json -p ../../","lint":"eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix","version":"node ../../scripts/version-update.js","precompile":"lerna run version --scope $(npm pkg get name) --include-dependencies","prewatch":"npm run precompile","peer-api-check":"node ../../scripts/peer-api-check.js"},"keywords":["opentelemetry","nodejs","tracing","profiling","metrics","stats"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","engines":{"node":">=14"},"publishConfig":{"access":"public"},"devDependencies":{"@opentelemetry/api":">=1.0.0 <1.5.0","@types/mocha":"10.0.0","@types/node":"18.6.5","codecov":"3.8.3","mocha":"10.0.0","nyc":"15.1.0","rimraf":"4.1.2","ts-mocha":"10.0.0","typescript":"4.4.4"},"peerDependencies":{"@opentelemetry/api":">=1.0.0 <1.5.0"},"homepage":"https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-context-async-hooks","sideEffects":false,"gitHead":"1328ee04ae78f9f6cf143af7050c00aaa6d2eb3b","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js/issues"},"_id":"@opentelemetry/context-async-hooks@1.11.0","_nodeVersion":"14.18.1","_npmVersion":"lerna/6.0.3/node@v14.18.1+x64 (darwin)","dist":{"integrity":"sha512-Ao1z7p+Au7A10SvQ6NCo5h2dAb3cujy+1VUZrd6gZuqMTxADYEWw/yjDbkHM/NAAaBphDGhqNg2MxGYIdgQs8w==","shasum":"45bbd5f574a8e6aca0cd1af676e906d0626662a7","tarball":"http://registry-npm.ywwl.com/@opentelemetry/context-async-hooks/download/@opentelemetry/context-async-hooks-1.11.0.tgz","fileCount":18,"unpackedSize":59263,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDCLe+8KHFsyBAPZXosSXgQ3zmzB6DMhBWgXjcVAKNSfAIgI9vMZBdZiCZA9SQB1OaS5r22rvhq0dNdGBzdzsb19UU="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkJasqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqiIxAAmXarym5b09DMTW0WBDxkJffY9nZvJaJxO3AC3ksoe7dprtDu\r\naaJzdRWQ860SFnGBpnhBh37ejivIklu73Hr4dgAyjx6QJ0vxVb8fFnmR2+Tw\r\nPjLmPjWKMmEOfwAL9q9Qq7xOVJ3arhPpAxfHzFZitXQEZHODOadbjgAAd/Fq\r\nTUooNKa3J93VGaQ21Fnn4jloOtWHMaUeMmT/sUKmpZIM7JNliWmnxlbWcrog\r\nYYHdcEZjSLRnTq2GrZ9n4vOSFLjB1ifFVtWZ7NxtSHVPH8yHSw+cSab2l1jT\r\nLiuINvQ1bxvkmjhj9aUmSgJvoRH75O1PO86dbfsfKwRLTCBquxMRvdwRQQp5\r\nGgaP5xmKi7/Rq3bT/RiyOtBZVv68joAc9QMRTtMgRcCsMdr5DgxPRJ5a7M25\r\nZwOJbSsW6H454RCBN1He0rKizxrMKj+mcql2RzIaa+JuVVSgq2vAvEjhYHeQ\r\nbIBjFxVzenLZkA1OzM0Qn5dGrtFLejC5rX46MRHtmeOsfZvpcdQOdHfSygu9\r\n5pzeg46qIQgs5LxXJ+ysUmIKLYNhZKsmXGZwnJTP8HM6azHndsnzZmIPs+s7\r\n4zsa5gZoxDcBUi2k9dDaJW76fsm27t8jvuJsis5fLFaY4GSyC+qEqykmCNxr\r\nQD+HyZcjsoCwfz7Xdtv4iIw/tNg4eSNFfK4=\r\n=YwdR\r\n-----END PGP SIGNATURE-----\r\n","size":13835,"noattachment":false,"key":"/@opentelemetry/context-async-hooks/-/@opentelemetry/context-async-hooks-1.11.0.tgz"},"_npmUser":{"name":"dyladan","email":"dyladan@gmail.com"},"directories":{},"maintainers":[{"name":"bogdandrutu","email":"bogdandrutu@gmail.com"},{"name":"dyladan","email":"dyladan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/context-async-hooks_1.11.0_1680190250206_0.18008589693621246"},"_hasShrinkwrap":false,"readme":"# OpenTelemetry async_hooks-based Context Managers\n\n[![NPM Published Version][npm-img]][npm-url]\n[![Apache License][license-image]][license-image]\n\nThis package provides two [`ContextManager`](https://open-telemetry.github.io/opentelemetry-js/interfaces/_opentelemetry_api.ContextManager.html) 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](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-context-zone) or [opentelemetry-context-zone-peer-dep](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-context-zone-peer-dep).\n\nThe definition of the `ContextManager` interface and the problem it solves can be found [here][def-context-manager].\n\n## API\n\nTwo `ContextManager` implementations are exported:\n\n- `AsyncLocalStorageContextManager`, based on [`AsyncLocalStorage`](https://nodejs.org/api/async_context.html#class-asynclocalstorage)\n- `AsyncHooksContextManager`, based on [`AsyncHook`](https://nodejs.org/api/async_hooks.html#async_hooks_class_asynchook)\n\nThe former should be preferred over the latter as its implementation is substantially simpler than the latter's, and according to [Node.js docs](https://github.com/nodejs/node/blame/v17.1.0/doc/api/async_context.md#L42-L45),\n\n> While you can create your own implementation [of `AsyncLocalStorage`] on top of [`AsyncHook`], `AsyncLocalStorage` should be preferred as it is a performant and memory safe implementation that involves significant optimizations that are non-obvious to implement.\n\n`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](https://github.com/nodejs/node/pull/34573)).\n\n## Limitations\n\nIt'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 [here][pkgs-that-break-ah] for known issues.\n\nasync_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.\n\n## Prior art\n\nContext propagation is a big subject when talking about tracing in Node.js. If you want more information about it here are some resources:\n\n- <https://www.npmjs.com/package/continuation-local-storage> (which was the old way of doing context propagation)\n- Datadog's own implementation for their JavaScript tracer: [here][dd-js-tracer-scope]\n- OpenTracing implementation: [here][opentracing-scope]\n- Discussion about context propagation by the Node.js Diagnostics Working Group: [here][diag-team-scope-discussion]\n\n## Useful links\n\n- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>\n- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>\n- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]\n\n## License\n\nApache 2.0 - See [LICENSE][license-url] for more information.\n\n[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions\n[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE\n[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat\n[async-hooks-doc]: http://nodejs.org/dist/latest/docs/api/async_hooks.html\n[def-context-manager]: https://opentelemetry.io/docs/instrumentation/js/api/context/#context-manager\n[dd-js-tracer-scope]: https://github.com/DataDog/dd-trace-js/blob/master/packages/dd-trace/src/scope.js\n[opentracing-scope]: https://github.com/opentracing/opentracing-javascript/pull/113\n[diag-team-scope-discussion]: https://github.com/nodejs/diagnostics/issues/300\n[pkgs-that-break-ah]: https://github.com/nodejs/diagnostics/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Aasync-continuity\n[npm-url]: https://www.npmjs.com/package/@opentelemetry/context-async-hooks\n[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fcontext-async-hooks.svg\n","publish_time":1680190250390,"_cnpm_publish_time":1680190250390,"dist-tags":{"canary":"3.0.0-rc.0","latest":"3.1.0","next":"1.8.0"}}