> ## Documentation Index
> Fetch the complete documentation index at: https://otel.fyi/llms.txt
> Use this file to discover all available pages before exploring further.

# Redis

> OpenTelemetry receiver for Redis

# Redis Receiver

![Status](https://img.shields.io/badge/status-beta-yellow)

**Available in:** `contrib`

**Maintainers:** [@dmitryax](https://github.com/dmitryax), [@hughesjj](https://github.com/hughesjj)

**Source:** [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/redisreceiver)

## Supported Telemetry

![Metrics](https://img.shields.io/badge/metrics-beta-green)

## Overview

## Details

The Redis INFO command returns information and statistics about a Redis
server (see [https://redis.io/commands/info](https://redis.io/commands/info) for
details). The Redis receiver extracts values from the result and converts them to open
telemetry metrics. Details about the metrics produced by the Redis receiver
can be found by browsing [metric\_functions.go](metric_functions.go).

For example, one of the fields returned by the Redis INFO command is
`used_cpu_sys` which indicates the system CPU consumed by the Redis server,
expressed in seconds, since the start of the Redis instance.

The Redis receiver turns this data into a gauge...

```go theme={null}
func usedCPUSys() *redisMetric {
	return &redisMetric{
		key:    "used_cpu_sys",
		name:   "redis.cpu.time",
		units:  "s",
		mdType: metricspb.MetricDescriptor_GAUGE_DOUBLE,
		labels: map[string]string{"state": "sys"},
	}
}
```

with a metric name of `redis.cpu.time` and a units value of `s` (seconds).

## Configuration

The following settings are required:

* `endpoint` (no default): The hostname and port of the Redis instance,
  separated by a colon.

The following settings are optional:

* `collection_interval` (default = `10s`): This receiver runs on an interval.
  Each time it runs, it queries Redis, creates metrics, and sends them to the
  next consumer. The `collection_interval` configuration option tells this
  receiver the duration between runs. This value must be a string readable by
  Golang's `ParseDuration` function (example: `1h30m`). Valid time units are
  `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`.
* `username` (no default): Client username used to connect to a Redis >=6.0 instance that is using the Redis ACL system.
* `password` (no default): The password used to access the Redis instance;
  must match the password specified in the `requirepass` server configuration option in Redis \<6.0.
  For Redis >=6.0, the user's password when connecting using the Redis ACL system.
* `transport` (default = `tcp`) Defines the network to use for connecting to the server. Valid Values are `tcp` or `Unix`
* `tls`:
  * `insecure` (default = true): whether to disable client transport security for the exporter's connection.
  * `ca_file`: path to the CA cert. For a client this verifies the server certificate. Should only be used if `insecure` is set to false.
  * `cert_file`: path to the TLS cert to use for TLS required connections. Should only be used if `insecure` is set to false.
  * `key_file`: path to the TLS key to use for TLS required connections. Should only be used if `insecure` is set to false.

Example:

```yaml theme={null}
receivers:
  redis:
    endpoint: "localhost:6379"
    collection_interval: 10s
    password: ${env:REDIS_PASSWORD}
```

> :information\_source: As with all Open Telemetry configuration values, a
> reference to an environment variable is supported. For example, to pick up
> the value of an environment variable `REDIS_PASSWORD`, you could use a
> configuration like the following:

```yaml theme={null}
receivers:
  redis:
    endpoint: "localhost:6379"
    collection_interval: 10s
    password: ${env:REDIS_PASSWORD}
```

The full list of settings exposed for this receiver are documented in [config.go](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/redisreceiver/config.go)
with detailed sample configurations in [testdata/config.yaml](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/redisreceiver/testdata/config.yaml).

## Metrics

| Metric Name                                         | Description                                                                                           | Unit          | Type          | Attributes      |
| --------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------- | ------------- | --------------- |
| ✅ `redis.clients.blocked`                           | Number of clients pending on a blocking call                                                          | \{client}     | UpDownCounter |                 |
| ✅ `redis.clients.connected`                         | Number of client connections (excluding connections from replicas)                                    | \{client}     | UpDownCounter |                 |
| ✅ `redis.clients.max_input_buffer`                  | Biggest input buffer among current client connections                                                 | By            | Gauge         |                 |
| ✅ `redis.clients.max_output_buffer`                 | Longest output list among current client connections                                                  | By            | Gauge         |                 |
| ❌ `redis.cluster.cluster_enabled`                   | Indicate Redis cluster is enabled                                                                     | 1             | Gauge         |                 |
| ❌ `redis.cluster.known_nodes`                       | Number of known nodes in the cluster                                                                  | \{node}       | Gauge         |                 |
| ❌ `redis.cluster.links_buffer_limit_exceeded.count` | Total number of times the cluster links buffer limit was exceeded                                     | \{count}      | Counter       |                 |
| ❌ `redis.cluster.node.count`                        | Number of master nodes in the cluster                                                                 | \{node}       | Gauge         |                 |
| ❌ `redis.cluster.node.uptime`                       | The node's current epoch                                                                              | s             | Gauge         |                 |
| ❌ `redis.cluster.slots_assigned`                    | Number of slots assigned in the cluster                                                               | \{slot}       | Gauge         |                 |
| ❌ `redis.cluster.slots_fail`                        | Number of slots in the cluster that are in a failing state                                            | \{slot}       | Gauge         |                 |
| ❌ `redis.cluster.slots_ok`                          | Number of slots in the cluster that are ok                                                            | \{slot}       | Gauge         |                 |
| ❌ `redis.cluster.slots_pfail`                       | Number of slots in the cluster that are in a 'potentially failing' state                              | \{slot}       | Gauge         |                 |
| ❌ `redis.cluster.state`                             | State of the cluster                                                                                  | \{state}      | Gauge         | cluster\_state  |
| ❌ `redis.cluster.stats_messages_received`           | Total number of messages received by the cluster                                                      | \{message}    | Counter       |                 |
| ❌ `redis.cluster.stats_messages_sent`               | Total number of messages sent by the cluster                                                          | \{message}    | Counter       |                 |
| ❌ `redis.cluster.uptime`                            | Current epoch of the cluster                                                                          | s             | Gauge         |                 |
| ❌ `redis.cmd.calls`                                 | Total number of calls for a command                                                                   | \{call}       | Counter       | cmd             |
| ❌ `redis.cmd.latency`                               | Command execution latency                                                                             | s             | Gauge         | cmd, percentile |
| ❌ `redis.cmd.usec`                                  | Total time for all executions of this command                                                         | us            | Counter       | cmd             |
| ✅ `redis.commands`                                  | Number of commands processed per second                                                               | \{ops}/s      | Gauge         |                 |
| ✅ `redis.commands.processed`                        | Total number of commands processed by the server                                                      | \{command}    | Counter       |                 |
| ✅ `redis.connections.received`                      | Total number of connections accepted by the server                                                    | \{connection} | Counter       |                 |
| ✅ `redis.connections.rejected`                      | Number of connections rejected because of maxclients limit                                            | \{connection} | Counter       |                 |
| ✅ `redis.cpu.time`                                  | System CPU consumed by the Redis server in seconds since server start                                 | s             | Counter       | state           |
| ✅ `redis.db.avg_ttl`                                | Average keyspace keys TTL                                                                             | ms            | Gauge         | db              |
| ✅ `redis.db.expires`                                | Number of keyspace keys with an expiration                                                            | \{key}        | Gauge         | db              |
| ✅ `redis.db.keys`                                   | Number of keyspace keys                                                                               | \{key}        | Gauge         | db              |
| ✅ `redis.keys.evicted`                              | Number of evicted keys due to maxmemory limit                                                         | \{key}        | Counter       |                 |
| ✅ `redis.keys.expired`                              | Total number of key expiration events                                                                 | \{event}      | Counter       |                 |
| ✅ `redis.keyspace.hits`                             | Number of successful lookup of keys in the main dictionary                                            | \{hit}        | Counter       |                 |
| ✅ `redis.keyspace.misses`                           | Number of failed lookup of keys in the main dictionary                                                | \{miss}       | Counter       |                 |
| ✅ `redis.latest_fork`                               | Duration of the latest fork operation in microseconds                                                 | us            | Gauge         |                 |
| ❌ `redis.maxmemory`                                 | The value of the maxmemory configuration directive                                                    | By            | Gauge         |                 |
| ✅ `redis.memory.fragmentation_ratio`                | Ratio between used\_memory\_rss and used\_memory                                                      | 1             | Gauge         |                 |
| ✅ `redis.memory.lua`                                | Number of bytes used by the Lua engine                                                                | By            | Gauge         |                 |
| ✅ `redis.memory.peak`                               | Peak memory consumed by Redis (in bytes)                                                              | By            | Gauge         |                 |
| ✅ `redis.memory.rss`                                | Number of bytes that Redis allocated as seen by the operating system                                  | By            | Gauge         |                 |
| ✅ `redis.memory.used`                               | Total number of bytes allocated by Redis using its allocator                                          | By            | Gauge         |                 |
| ❌ `redis.memory.used_memory_overhead`               | The sum in bytes of all overheads that the server allocated for managing its internal data structures | By            | UpDownCounter |                 |
| ❌ `redis.memory.used_memory_startup`                | Initial amount of memory consumed by Redis at startup in bytes                                        | By            | UpDownCounter |                 |
| ❌ `redis.mode`                                      | Redis server mode                                                                                     | \{mode}       | Gauge         | mode            |
| ✅ `redis.net.input`                                 | The total number of bytes read from the network                                                       | By            | Counter       |                 |
| ✅ `redis.net.output`                                | The total number of bytes written to the network                                                      | By            | Counter       |                 |
| ✅ `redis.rdb.changes_since_last_save`               | Number of changes since the last dump                                                                 | \{change}     | UpDownCounter |                 |
| ✅ `redis.replication.backlog_first_byte_offset`     | The master offset of the replication backlog buffer                                                   | By            | Gauge         |                 |
| ✅ `redis.replication.offset`                        | The server's current replication offset                                                               | By            | Gauge         |                 |
| ❌ `redis.replication.replica_offset`                | Offset for redis replica                                                                              | By            | Gauge         |                 |
| ❌ `redis.role`                                      | Redis node's role                                                                                     | \{role}       | UpDownCounter | role            |
| ❌ `redis.sentinel.masters`                          | Number of masters monitored by Sentinel.                                                              | \{master}     | Gauge         |                 |
| ❌ `redis.sentinel.running_scripts`                  | Number of running Sentinel scripts.                                                                   | \{script}     | Gauge         |                 |
| ❌ `redis.sentinel.scripts_queue_length`             | Length of Sentinel scripts queue.                                                                     | \{script}     | Gauge         |                 |
| ❌ `redis.sentinel.simulate_failure_flags`           | Simulated failure flags bitmask.                                                                      | \{flag}       | Gauge         |                 |
| ❌ `redis.sentinel.tilt_since_seconds`               | Duration in seconds of current TILT, or -1 if not in TILT mode.                                       | s             | Gauge         |                 |
| ❌ `redis.sentinel.total_tilt`                       | Total TILT occurrences since start.                                                                   | \{event}      | Counter       |                 |
| ✅ `redis.slaves.connected`                          | Number of connected replicas                                                                          | \{replica}    | UpDownCounter |                 |
| ❌ `redis.tracking_total_keys`                       | Number of keys being tracked by the server                                                            | \{key}        | UpDownCounter |                 |
| ✅ `redis.uptime`                                    | Number of seconds since Redis server start                                                            | s             | Counter       |                 |

## Attributes

| Attribute Name  | Description               | Type   | Values                                                                                |
| --------------- | ------------------------- | ------ | ------------------------------------------------------------------------------------- |
| `cluster_state` | State of the cluster      | string | `ok`, `fail`                                                                          |
| `cmd`           | Redis command name        | string |                                                                                       |
| `db`            | Redis database identifier | string |                                                                                       |
| `mode`          | Redis server mode         | string | `cluster`, `sentinel`, `standalone`                                                   |
| `percentile`    | Percentile                | string | `p50`, `p99`, `p99.9`                                                                 |
| `role`          | Redis node's role         | string | `replica`, `primary`                                                                  |
| `state`         | Redis CPU usage state     | string | `sys`, `sys_children`, `sys_main_thread`, `user`, `user_children`, `user_main_thread` |

## Resource Attributes

| Attribute Name   | Description             | Type   | Enabled |
| ---------------- | ----------------------- | ------ | ------- |
| `redis.version`  | Redis server's version. | string | ✅       |
| `server.address` | Redis server's address  | string | ❌       |
| `server.port`    | Redis server's port     | string | ❌       |

## Configuration

### Example Configuration

```yaml theme={null}
redis:
  endpoint: "localhost:6379"
  username: "test"
  password: "test"
  collection_interval: 10s
  tls:
    insecure: true
```

***

*Last generated: 2026-07-06*
