---
title: Redis Metrics
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > OpenTelemetry in Datadog > Integrations > Redis Metrics
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Redis Metrics

## Overview{% #overview %}

{% image
   source="https://docs.dd-static.net/images/opentelemetry/collector_exporter/redis_metrics.bbb4173f9401c710207a57abcc56f55a.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/opentelemetry/collector_exporter/redis_metrics.bbb4173f9401c710207a57abcc56f55a.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="The Redis - Overview dashboard, showing tiles for hit rate, blocked clients, keyspace size, unsaved changes, and primary link down time." /%}

The [Redis receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/redisreceiver) collects Redis metrics that populate the [Redis - Overview](https://app.datadoghq.com/dash/integration/15/redis---overview) dashboard and the Redis high memory monitor. Configure the receiver according to the specifications of the latest version of the `redisreceiver`.

For more information, see the OpenTelemetry project documentation for the [Redis receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/redisreceiver).

## Setup{% #setup %}

To collect Redis metrics with OpenTelemetry for use with Datadog:

1. Configure the [Redis receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/redisreceiver) in your OpenTelemetry Collector configuration.
1. Configure the processors that convert the receiver's cumulative sums to the metric types Datadog expects.
1. Add the service pipelines to your Collector configuration.
1. Set up the OpenTelemetry Collector with the [recommended configuration](https://docs.datadoghq.com/opentelemetry/setup/collector_exporter.md), which exports to Datadog with the OTLP HTTP exporter (`otlp_http`).

### Redis receiver{% #redis-receiver %}

```yaml
receivers:
  redis/redis-host-1:
    endpoint: "<HOST>:<PORT>"
    password: "<PASSWORD>"
    collection_interval: 10s
    metrics:
      redis.maxmemory:
        enabled: true

processors:
  resource/redis-host-1:
    attributes:
      - action: insert
        key: datadog.host.name
        value: <HOSTNAME>
  transform/redis-host-1:
    metric_statements:
      - context: metric
        statements:
          - convert_sum_to_gauge() where metric.name == "redis.keys.evicted"
          - convert_sum_to_gauge() where metric.name == "redis.keys.expired"
          - convert_sum_to_gauge() where metric.name == "redis.connections.rejected"
  cumulativetodelta/redis-host-1:
    include:
      match_type: strict
      metrics:
        - redis.commands.processed
        - redis.cpu.time
        - redis.keyspace.hits
        - redis.keyspace.misses
  deltatorate/redis-host-1:
    metrics:
      - redis.commands.processed
      - redis.cpu.time
      - redis.keyspace.hits
      - redis.keyspace.misses
```

Replace `<HOST>` and `<PORT>` with the address of your Redis server, and `<HOSTNAME>` with the host name to show in Datadog. If your Redis server doesn't require a password, remove the `password` line.

`redis.mem.maxmemory` reports a value only when `maxmemory` is set on your Redis server.

See the [Redis receiver documentation](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/redisreceiver) for detailed configuration options and requirements.

### Service pipelines{% #service-pipelines %}

Add this pipeline under `service.pipelines` in your Collector configuration. The `otlp_http` exporter comes from the [recommended configuration](https://docs.datadoghq.com/opentelemetry/setup/collector_exporter.md).

```yaml
service:
  pipelines:
    metrics/redis-host-1:
      receivers: [redis/redis-host-1]
      processors: [resource/redis-host-1, transform/redis-host-1, cumulativetodelta/redis-host-1, deltatorate/redis-host-1]
      exporters: [otlp_http]
```

## Data collected{% #data-collected %}

| OTEL                              | DESCRIPTION                                                           | FILTER          |
| --------------------------------- | --------------------------------------------------------------------- | --------------- |
| redis.clients.blocked             | Number of clients pending on a blocking call                          |
| redis.clients.connected           | Number of client connections (excluding connections from replicas)    |
| redis.commands.processed          | Total number of commands processed by the server                      |
| redis.connections.rejected        | Number of connections rejected because of maxclients limit            |
| redis.cpu.time                    | System CPU consumed by the Redis server in seconds since server start | `state`: `sys`  |
| redis.cpu.time                    | System CPU consumed by the Redis server in seconds since server start | `state`: `user` |
| redis.db.expires                  | Number of keyspace keys with an expiration                            |
| redis.db.keys                     | Number of keyspace keys                                               |
| redis.keys.evicted                | Number of evicted keys due to maxmemory limit                         |
| redis.keys.expired                | Total number of key expiration events                                 |
| redis.keyspace.hits               | Number of successful lookup of keys in the main dictionary            |
| redis.keyspace.misses             | Number of failed lookup of keys in the main dictionary                |
| redis.maxmemory                   | The value of the maxmemory configuration directive                    |
| redis.memory.fragmentation_ratio  | Ratio between used_memory_rss and used_memory                         |
| redis.memory.rss                  | Number of bytes that Redis allocated as seen by the operating system  |
| redis.memory.used                 | Total number of bytes allocated by Redis using its allocator          |
| redis.rdb.changes_since_last_save | Number of changes since the last dump                                 |
| redis.slaves.connected            | Number of connected replicas                                          |

The `db` attribute on `redis.db.keys` and `redis.db.expires` maps to the Datadog `redis_db` tag.

For the full mapping between OpenTelemetry and Datadog metric names, see [OpenTelemetry Metrics Mapping](https://docs.datadoghq.com/opentelemetry/mapping/metrics_mapping.md).

### Known limitations{% #known-limitations %}

- The receiver sets `db` to the bare database index, such as `0`, while the Agent tags `redis_db:db0`. OpenTelemetry series appear as `redis_db:0`, so filters such as `redis_db:db0` don't match them. The Redis - Overview dashboard doesn't filter or group by `redis_db`.
- These Datadog metrics have no Redis receiver equivalent:
  - `redis.info.latency_ms`
  - `redis.key.length`
  - `redis.replication.delay`
  - `redis.replication.master_link_down_since_seconds`
  - `redis.slowlog.micros.95percentile`
  - `redis.slowlog.micros.count`

## Further reading{% #further-reading %}

Additional helpful documentation, links, and articles:

- [Setting Up the OpenTelemetry Collector](https://docs.datadoghq.com/opentelemetry/setup/collector_exporter.md)
