{"name":"@opentelemetry/instrumentation-redis","version":"0.69.0","keywords":["instrumentation","nodejs","opentelemetry","profiling","redis","tracing"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","_id":"@opentelemetry/instrumentation-redis@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-redis#readme","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js-contrib/issues"},"dist":{"shasum":"ab622501852afdd3634021a123a0c67ac0596b6c","tarball":"http://registry-npm.ywwl.com/@opentelemetry/instrumentation-redis/download/@opentelemetry/instrumentation-redis-0.69.0.tgz","fileCount":36,"integrity":"sha512-lyCIEW89cYhMwaUSMBzsKHdwH2wOoqmuwXOARJneo9UL55govLIUCbYYAJ457oM8kdKADymlY4+SUW0DKQeIHw==","signatures":[{"sig":"MEUCIFs4Wu5yN6Md7WQROhL+zGxn3dmLd5cbg358EHZBN8bYAiEAsyJglPicBFwK/7GKVmeqfTszg04vavnidKcLipYYvAU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@opentelemetry%2finstrumentation-redis@0.69.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":116911,"size":26093,"noattachment":false,"key":"/@opentelemetry/instrumentation-redis/-/@opentelemetry/instrumentation-redis-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 --require '@opentelemetry/contrib-test-utils' 'test/v4-v5/*.test.ts' 'test/*.test.ts'","clean":"rimraf build/*","compile":"tsc -p .","test-v2-v3":"nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/v2-v3/*.test.ts'","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-redis","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:f5542faa-a021-488d-a752-71b7a85c6d3e"}},"repository":{"url":"git+https://github.com/open-telemetry/opentelemetry-js-contrib.git","type":"git","directory":"packages/instrumentation-redis"},"_npmVersion":"lerna/9.0.7/node@v24.18.0+x64 (linux)","description":"OpenTelemetry instrumentation for `redis` database client for Redis","directories":{},"_nodeVersion":"24.18.0","dependencies":{"@opentelemetry/redis-common":"^0.38.3","@opentelemetry/instrumentation":"^0.221.0","@opentelemetry/semantic-conventions":"^1.27.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"redis":"^5.6.0","@opentelemetry/api":"^1.3.0","@opentelemetry/contrib-test-utils":"^0.68.0","@opentelemetry/context-async-hooks":"^2.0.0"},"peerDependencies":{"@opentelemetry/api":"^1.3.0"},"_npmOperationalInternal":{"tmp":"tmp/instrumentation-redis_0.69.0_1784829468641_0.23141533492074462","host":"s3://npm-registry-packages-npm-production"},"readme":"# OpenTelemetry redis 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 [`redis`](https://github.com/NodeRedis/node_redis) module versions `>=2.6.0 <6`.\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```bash\nnpm install --save @opentelemetry/instrumentation-redis\n```\n\n### Supported Versions\n\n- [`redis`](https://www.npmjs.com/package/redis) versions `>=2.6.0 <7`\n\n## Usage\n\nOpenTelemetry Redis Instrumentation allows the user to automatically collect trace data and export them to the backend of choice, to give observability to distributed systems when working with [redis](https://www.npmjs.com/package/redis).\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 { RedisInstrumentation } = require('@opentelemetry/instrumentation-redis');\n\nconst sdk = new NodeSDK({\n  instrumentations: [\n    new RedisInstrumentation(),\n  ],\n});\nsdk.start();\nprocess.once('beforeExit', async () => { await sdk.shutdown(); });\n```\n\nSee [examples/redis](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/examples/redis) for a short example.\n\n### Redis Instrumentation Options\n\nRedis instrumentation has a few options available to choose from. You can set the following:\n\n| Options                 | Type                                              | Description                                                                                                    |\n|-------------------------|---------------------------------------------------|----------------------------------------------------------------------------------------------------------------|\n| `dbStatementSerializer` | `DbStatementSerializer` (function)                | Redis instrumentation will serialize the command to the `db.statement` attribute using the specified function. |\n| `responseHook`          | `RedisResponseCustomAttributeFunction` (function) | Function for adding custom attributes on db response. Receives params: `span, moduleVersion, cmdName, cmdArgs` |\n| `requireParentSpan`     | `boolean`                                         | Require parent to create redis span, default when unset is false.                                              |\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 as 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\nwill receive the command name and arguments and must return a string.\n\nHere is a simple example to serialize the command name and all command arguments.\nNotice that it might capture sensitive data and big payloads:\n\n```javascript\nconst { RedisInstrumentation } = require('@opentelemetry/instrumentation-redis');\n\nconst redisInstrumentation = new RedisInstrumentation({\n  dbStatementSerializer: function (cmdName, cmdArgs) {\n    return [cmdName, ...cmdArgs].join(\" \");\n  },\n});\n```\n\n## Semantic Conventions\n\nThe `instrumentation-redis` versions 0.68.0 and later emit the stable v1.33.0+ semantic conventions.\n\n| Attribute           | Short Description                                    |\n|---------------------|------------------------------------------------------|\n| `db.operation.name` | Redis command name                                   |\n| `db.query.text`     | The database query being executed                    |\n| `db.system.name`    | Database identifier; always `redis`                  |\n| `server.address`    | Hostname or IP of the connected Redis server         |\n| `server.port`       | Port of the connected Redis server                   |\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-redis\n[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-redis.svg\n","publish_time":1784829468777,"_cnpm_publish_time":1784829468777,"dist-tags":{"latest":"0.73.0"}}