|
3 | 3 | [![NPM Published Version][npm-img]][npm-url] |
4 | 4 | [![Apache License][license-image]][license-image] |
5 | 5 |
|
6 | | -This module provides automatic instrumentation for the [`ioredis`](https://github.com/luin/ioredis) module, which may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package and is included in the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle. |
| 6 | +This module provides automatic instrumentation for the [`ioredis`](https://github.com/luin/ioredis) module, supporting both single Redis instances and Redis Clusters (when enabled via configuration). It may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package and is included in the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle. |
7 | 7 |
|
8 | 8 | If 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. |
9 | 9 |
|
@@ -52,6 +52,7 @@ IORedis instrumentation has few options available to choose from. You can set th |
52 | 52 | | `requestHook` | `RedisRequestCustomAttributeFunction` (function) | Function for adding custom attributes on db request. Receives params: `span, { moduleVersion, cmdName, cmdArgs }` | |
53 | 53 | | `responseHook` | `RedisResponseCustomAttributeFunction` (function) | Function for adding custom attributes on db response | |
54 | 54 | | `requireParentSpan` | `boolean` | Require parent to create ioredis span, default when unset is true | |
| 55 | +| `instrumentCluster` | `boolean` | Instrument `ioredis` `Cluster` class, default when unset is false | |
55 | 56 |
|
56 | 57 | #### Custom db.statement Serializer |
57 | 58 |
|
@@ -112,6 +113,18 @@ Attributes collected: |
112 | 113 | | `net.peer.name` | Remote hostname or similar. | |
113 | 114 | | `net.peer.port` | Remote port number. | |
114 | 115 |
|
| 116 | +### Cluster Attributes |
| 117 | + |
| 118 | +When `instrumentCluster: true` is enabled, different attributes are collected for Redis Cluster operations: |
| 119 | + |
| 120 | +| Attribute | Short Description | |
| 121 | +|------------------------|-----------------------------------------------------------------------------| |
| 122 | +| `db.redis.cluster.nodes` | Array of cluster node addresses in `host:port` format. | |
| 123 | +| `db.redis.cluster.startup_nodes` | Array of startup node addresses used to connect to cluster. | |
| 124 | +| `db.redis.is_cluster` | Boolean indicating if this is a cluster operation (always `true`). | |
| 125 | + |
| 126 | +**Note:** These attributes are only present on spans created for cluster operations (e.g., `cluster.hset`, `cluster.connect`) when cluster instrumentation is enabled. |
| 127 | + |
115 | 128 | ## Useful links |
116 | 129 |
|
117 | 130 | - For more information on OpenTelemetry, visit: <https://opentelemetry.io/> |
|
0 commit comments