{"name":"@opentelemetry/sdk-trace-node","version":"1.29.0","keywords":["opentelemetry","nodejs","tracing","profiling","metrics","stats"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","_id":"@opentelemetry/sdk-trace-node@1.29.0","maintainers":[{"name":"bogdandrutu","email":"bogdandrutu@gmail.com"},{"name":"dyladan","email":"dyladan@gmail.com"},{"name":"pichlermarc","email":"marc.pichler@dynatrace.com"}],"homepage":"https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js/issues"},"dist":{"shasum":"433adf34ffdd3221088544415db1859c52b3637c","tarball":"http://registry-npm.ywwl.com/@opentelemetry/sdk-trace-node/download/@opentelemetry/sdk-trace-node-1.29.0.tgz","fileCount":15,"integrity":"sha512-ZpGYt+VnMu6O0SRKzhuIivr7qJm3GpWnTCMuJspu4kt3QWIpIenwixo5Vvjuu3R4h2Onl/8dtqAiPIs92xd5ww==","signatures":[{"sig":"MEUCIArDtisWeHlXSpw+Y/976uAmtQhohx8DHlrpxK9+YR1qAiEA+7dMqd8TUEZdTC49kei5KXmE2n7+4usVorSr7TRpgmg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@opentelemetry%2fsdk-trace-node@1.29.0","provenance":{"predicateType":"https://slsa.dev/provenance/v0.2"}},"unpackedSize":35643,"size":9503,"noattachment":false,"key":"/@opentelemetry/sdk-trace-node/-/@opentelemetry/sdk-trace-node-1.29.0.tgz"},"main":"build/src/index.js","types":"build/src/index.d.ts","engines":{"node":">=14"},"gitHead":"85dcbc7c55f002837f1bf1bf01145dbb34a55b40","scripts":{"tdd":"npm run test -- --watch-extensions ts --watch","lint":"eslint . --ext .ts","test":"nyc mocha 'test/**/*.test.ts'","clean":"tsc --build --clean","watch":"tsc --build --watch","compile":"tsc --build","version":"node ../../scripts/version-update.js","lint:fix":"eslint . --ext .ts --fix","prewatch":"npm run precompile","precompile":"cross-var lerna run version --scope $npm_package_name --include-dependencies","align-api-deps":"node ../../scripts/align-api-deps.js","peer-api-check":"node ../../scripts/peer-api-check.js","prepublishOnly":"npm run compile"},"_npmUser":{"name":"dyladan","email":"dyladan@gmail.com"},"repository":{"url":"git+https://github.com/open-telemetry/opentelemetry-js.git","type":"git"},"_npmVersion":"lerna/6.6.2/node@v18.20.5+x64 (linux)","description":"OpenTelemetry Node SDK provides automatic telemetry (tracing, metrics, etc) for Node.js applications","directories":{},"sideEffects":false,"_nodeVersion":"18.20.5","dependencies":{"semver":"^7.5.2","@opentelemetry/core":"1.29.0","@opentelemetry/propagator-b3":"1.29.0","@opentelemetry/sdk-trace-base":"1.29.0","@opentelemetry/propagator-jaeger":"1.29.0","@opentelemetry/context-async-hooks":"1.29.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"15.1.0","lerna":"6.6.2","mocha":"10.8.2","sinon":"15.1.2","cross-var":"1.1.0","typescript":"4.4.4","@types/node":"18.6.5","@types/mocha":"10.0.10","@types/sinon":"17.0.3","@types/semver":"7.5.8","@opentelemetry/api":">=1.0.0 <1.10.0","@opentelemetry/resources":"1.29.0","@opentelemetry/semantic-conventions":"1.28.0"},"peerDependencies":{"@opentelemetry/api":">=1.0.0 <1.10.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk-trace-node_1.29.0_1733329972659_0.9794278224347308","host":"s3://npm-registry-packages"},"readme":"# OpenTelemetry Node SDK\n\n[![NPM Published Version][npm-img]][npm-url]\n[![Apache License][license-image]][license-image]\n\nThis module provides *automated instrumentation and tracing* for Node.js applications.\n\nFor manual instrumentation see the\n[@opentelemetry/sdk-trace-base](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-base) package.\n\n**Note: Much of OpenTelemetry JS documentation is written assuming the compiled application is run as CommonJS.**\nFor more details on ECMAScript Modules vs CommonJS, refer to [esm-support](https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/esm-support.md).\n\n## How auto instrumentation works\n\nThis package exposes a `NodeTracerProvider`.\nFor loading instrumentations please use `registerInstrumentations` function from [opentelemetry-instrumentation](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation)\n\nOpenTelemetry comes with a growing number of instrumentation plugins for well known modules (see [supported modules](https://github.com/open-telemetry/opentelemetry-js#instrumentations)) and an API to create custom instrumentation (see [the instrumentation developer guide](https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/instrumentation-guide.md)).\n\n> **Please note:** This module does *not* bundle any plugins. They need to be installed separately.\n\nThis is done by wrapping all tracing-relevant functions.\n\nThis instrumentation code will automatically\n\n- extract a trace-context identifier from inbound requests to allow distributed tracing (if applicable)\n- make sure that this current trace-context is propagated while the transaction traverses an application (see [context document in @opentelemetry/api][def-context] for an in-depth explanation)\n- add this trace-context identifier to outbound requests to allow continuing the distributed trace on the next hop (if applicable)\n- create and end spans\n\n## Creating custom spans on top of auto-instrumentation\n\nAdditionally to automated instrumentation, `NodeTracerProvider` exposes the same API as [@opentelemetry/sdk-trace-base](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-base), allowing creating custom spans if needed.\n\n## Installation\n\n```bash\nnpm install --save @opentelemetry/api\nnpm install --save @opentelemetry/sdk-trace-node\n\n# Install instrumentation plugins\nnpm install --save @opentelemetry/instrumentation-http\n# and for example one additional\nnpm install --save @opentelemetry/instrumentation-graphql\n```\n\n## Usage\n\nThe following code will configure the `NodeTracerProvider` to instrument `http`\n(and any other installed [supported\nmodules](https://github.com/open-telemetry/opentelemetry-js#plugins))\nusing `@opentelemetry/plugin-http`.\n\n```javascript\nconst { registerInstrumentations } = require('@opentelemetry/instrumentation');\nconst { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');\n\n// Create and configure NodeTracerProvider\nconst provider = new NodeTracerProvider();\n\n// Initialize the provider\nprovider.register();\n\n// register and load instrumentation and old plugins - old plugins will be loaded automatically as previously\n// but instrumentations needs to be added\nregisterInstrumentations({\n});\n\n// Your application code - http will automatically be instrumented if\n// @opentelemetry/plugin-http is present\nconst http = require('http');\n```\n\n## Instrumentation configuration\n\nIn the following example:\n\n- the express instrumentation is enabled\n- the http instrumentation has a custom config for a `requestHook`\n\n```javascript\nconst { registerInstrumentations } = require('@opentelemetry/instrumentation');\nconst { HttpInstrumentation } = require('@opentelemetry/instrumentation-http');\nconst { ExpressInstrumentation } = require('@opentelemetry/instrumentation-express');\n\nconst provider = new NodeTracerProvider();\nprovider.register();\n\n// register and load instrumentation and old plugins - old plugins will be loaded automatically as previously\n// but instrumentations needs to be added\nregisterInstrumentations({\n  instrumentations: [\n    new ExpressInstrumentation(),\n    new HttpInstrumentation({\n        requestHook: (span, request) => {\n          span.setAttribute(\"custom request hook attribute\", \"request\");\n        },\n    }),\n  ],\n});\n\n\n```\n\n## Examples\n\nSee how to automatically instrument [http](https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/http) and [grpc-js](https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/grpc-js) using node-sdk.\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[def-context]: https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/context.md\n[npm-url]: https://www.npmjs.com/package/@opentelemetry/sdk-trace-node\n[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fsdk-trace-node.svg\n","publish_time":1733329972853,"deprecated":"Use @opentelemetry/sdk-trace package","_cnpm_publish_time":1733329972853,"dist-tags":{"canary":"2.11.0-development.0","latest":"2.12.0","next":"1.8.0"}}