{"name":"@opentelemetry/instrumentation-ioredis","version":"0.69.0","keywords":["instrumentation","ioredis","nodejs","opentelemetry","profiling","redis","tracing"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","_id":"@opentelemetry/instrumentation-ioredis@0.69.0","maintainers":[{"name":"dyladan","email":"dyladan@gmail.com"},{"name":"pichlermarc","email":"marc.pichler@dynatrace.com"},{"name":"overbalance","email":"overbalancedev@proton.me"},{"name":"npmjs-account","email":"npmjs-account@opentelemetry.io"},{"name":"trentm","email":"trentm@gmail.com"},{"name":"martinkuba","email":"martin@martinkuba.com"}],"homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-ioredis#readme","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js-contrib/issues"},"dist":{"shasum":"3b35e874b8b9f022008371d80d6767fca1e06241","tarball":"http://registry-npm.ywwl.com/@opentelemetry/instrumentation-ioredis/download/@opentelemetry/instrumentation-ioredis-0.69.0.tgz","fileCount":24,"integrity":"sha512-I9sZtxXWZ1tRXtRNTEVxpokGtXy6RL1SZhtPVh7zxH78t8ar71V5Dx4bnQiUjKTDzItpC73krD8c0/cEWA9oLg==","signatures":[{"sig":"MEYCIQCTsn4Velx+567jgRONYZmU59LudJH2JBhGQ7ew0CU57QIhAOw+5FVHhUvz/ZIPdKX3tFFky1u+wwSVbIdD/Rw5nB8i","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@opentelemetry%2finstrumentation-ioredis@0.69.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":53694,"size":13731,"noattachment":false,"key":"/@opentelemetry/instrumentation-ioredis/-/@opentelemetry/instrumentation-ioredis-0.69.0.tgz"},"main":"build/src/index.js","types":"build/src/index.d.ts","engines":{"node":"^18.19.0 || >=20.6.0"},"gitHead":"27e172a9e0d549559056ccd58f27d13467454156","scripts":{"tdd":"npm run test -- --watch-extensions ts --watch","test":"nyc --no-clean mocha 'test/**/*.test.ts'","clean":"rimraf build/*","compile":"tsc -p .","test:debug":"cross-env RUN_REDIS_TESTS=true mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'","lint:readme":"node ../../scripts/lint-readme.js","prepublishOnly":"npm run compile","version:update":"node ../../scripts/version-update.js","test-services:ls":"echo redis","test-all-versions":"tav","test-services:stop":"cd ../.. && npm run test-services:stop redis","test-services:start":"cd ../.. && npm run test-services:start redis","test:with-services-env":"cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm test","compile:with-dependencies":"nx run-many -t compile -p @opentelemetry/instrumentation-ioredis","test-all-versions:with-services-env":"cross-env NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=../../test/test-services.env npm run test-all-versions"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:9cac6bfb-d177-44ae-b2e9-7a23a2df3879"}},"repository":{"url":"git+https://github.com/open-telemetry/opentelemetry-js-contrib.git","type":"git","directory":"packages/instrumentation-ioredis"},"_npmVersion":"lerna/9.0.7/node@v24.18.0+x64 (linux)","description":"OpenTelemetry instrumentation for `ioredis` database redis client for Redis","directories":{},"_nodeVersion":"24.18.0","dependencies":{"@opentelemetry/redis-common":"^0.38.3","@opentelemetry/instrumentation":"^0.221.0","@opentelemetry/semantic-conventions":"^1.33.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ioredis":"5.8.2","@types/ioredis4":"npm:@types/ioredis@4.28.10","@opentelemetry/api":"^1.3.0","@opentelemetry/sdk-trace":"^2.9.0","@opentelemetry/contrib-test-utils":"^0.68.0","@opentelemetry/context-async-hooks":"^2.9.0"},"peerDependencies":{"@opentelemetry/api":"^1.3.0"},"_npmOperationalInternal":{"tmp":"tmp/instrumentation-ioredis_0.69.0_1784829458313_0.5971092277781409","host":"s3://npm-registry-packages-npm-production"},"readme":"# OpenTelemetry ioredis Instrumentation for Node.js\n\n[![NPM Published Version][npm-img]][npm-url]\n[![Apache License][license-image]][license-image]\n\nThis module provides automatic instrumentation for the [`ioredis`](https://github.com/luin/ioredis) module.\n\nIf total installation size is not constrained, it is recommended to use the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle with [@opentelemetry/sdk-node](https://www.npmjs.com/package/@opentelemetry/sdk-node) for the most seamless instrumentation experience.\n\nCompatible with OpenTelemetry JS API and SDK `1.0+`.\n\n## Installation\n\n```sh\nnpm install --save @opentelemetry/instrumentation-ioredis\n```\n\n### Supported Versions\n\n- [`ioredis`](https://www.npmjs.com/package/ioredis) versions `>=2.0.0 <7`\n\n## Usage\n\nTo enable a specific instrumentation, pass it to `registerInstrumentations()`.\nThis is commonly done via `NodeSDK` for fully setting up all OpenTelemetry SDK components:\n\n```js\nconst { NodeSDK } = require('@opentelemetry/sdk-node');\nconst { IORedisInstrumentation } = require('@opentelemetry/instrumentation-ioredis');\n\nconst sdk = new NodeSDK({\n  instrumentations: [\n    new IORedisInstrumentation({\n      // see below for available configuration\n    }),\n  ],\n});\nsdk.start();\nprocess.once('beforeExit', async () => { await sdk.shutdown(); });\n```\n\n### IORedis Instrumentation Options\n\nIORedis instrumentation has few options available to choose from. You can set the following:\n\n| Options                 | Type                                              | Description |\n| ----------------------- | ------------------------------------------------- | ----------- |\n| `dbStatementSerializer` | `DbStatementSerializer`                           | IORedis instrumentation will serialize db.statement using the specified function. |\n| `requestHook`           | `RedisRequestCustomAttributeFunction` (function)  | Function for adding custom attributes on db request. Receives params: `span, { moduleVersion, cmdName, cmdArgs }` |\n| `responseHook`          | `RedisResponseCustomAttributeFunction` (function) | Function for adding custom attributes on db response |\n| `requireParentSpan`     | `boolean`                                         | Require parent to create ioredis span, default when unset is true |\n\n#### Custom db.statement Serializer\n\nThe instrumentation serializes the command into a Span attribute called `db.statement`. The standard serialization format attempts to be as informative\nas possible while avoiding the export of potentially sensitive data. The number of serialized arguments depends on the specific command, see the configuration\nlist in `@opentelemetry/redis-common`.\n\nIt is also possible to define a custom serialization function. The function will receive the command name and arguments and must return a string.\n\nHere is a simple example to serialize the command name skipping arguments:\n\n```javascript\nconst { IORedisInstrumentation } = require('@opentelemetry/instrumentation-ioredis');\n\nconst ioredisInstrumentation = new IORedisInstrumentation({\n  dbStatementSerializer: function (cmdName, cmdArgs) {\n    return cmdName;\n  },\n});\n```\n\n#### Using `requestHook`\n\nInstrumentation user can configure a custom \"hook\" function which will be called on every request with the relevant span and request information. User can then set custom attributes on the span or run any instrumentation-extension logic per request.\n\nHere is a simple example that adds a span attribute of `ioredis` instrumented version on each request:\n\n```javascript\nconst { IORedisInstrumentation } = require('@opentelemetry/instrumentation-ioredis');\n\nconst ioredisInstrumentation = new IORedisInstrumentation({\nrequestHook: function (\n    span: Span,\n    requestInfo: IORedisRequestHookInformation\n  ) {\n    if (requestInfo.moduleVersion) {\n      span.setAttribute(\n        'instrumented_library.version',\n        requestInfo.moduleVersion\n      );\n    }\n  }\n});\n\n```\n\n## Semantic Conventions\n\nThe `instrumentation-ioredis` versions 0.68.0 and later emit the stable v1.33.0+ semantic conventions.\n\nAttributes collected:\n\n| Attribute        | Description |\n| ---------------- | ----------- |\n| `db.system.name` | 'redis'     |\n| `db.query.text`  | The database query being executed. |\n| `db.operation.name` | The database operation name.    |\n| `server.port`    | Remote port number. |\n| `server.address` | Remote hostname or similar. |\n\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-contrib/blob/main/LICENSE\n[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat\n[npm-url]: https://www.npmjs.com/package/@opentelemetry/instrumentation-ioredis\n[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-ioredis.svg\n","publish_time":1784829458432,"_cnpm_publish_time":1784829458432,"dist-tags":{"latest":"0.73.0"}}