Skip to content

Commit cbbffff

Browse files
committed
docs(instrumentation-ioredis): document Redis Cluster support and attributes
1 parent 91100a4 commit cbbffff

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

packages/instrumentation-ioredis/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![NPM Published Version][npm-img]][npm-url]
44
[![Apache License][license-image]][license-image]
55

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.
77

88
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.
99

@@ -52,6 +52,7 @@ IORedis instrumentation has few options available to choose from. You can set th
5252
| `requestHook` | `RedisRequestCustomAttributeFunction` (function) | Function for adding custom attributes on db request. Receives params: `span, { moduleVersion, cmdName, cmdArgs }` |
5353
| `responseHook` | `RedisResponseCustomAttributeFunction` (function) | Function for adding custom attributes on db response |
5454
| `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 |
5556

5657
#### Custom db.statement Serializer
5758

@@ -112,6 +113,18 @@ Attributes collected:
112113
| `net.peer.name` | Remote hostname or similar. |
113114
| `net.peer.port` | Remote port number. |
114115

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+
115128
## Useful links
116129

117130
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>

0 commit comments

Comments
 (0)