Redis & Valkey
Monitor Redis and Valkey in-memory data stores with OpenTelemetry in Dash0. Track memory usage, cache hit ratio, client connections, command throughput, and evictions.
Overview
Redis is an open-source, in-memory data store that is widely used as a cache, session store, message broker, and rate limiter. Valkey is an open-source fork of Redis 7.2.4, developed under the Linux Foundation, that remains compatible with Redis clients and commands. Because so many services depend on them, a slow or memory-starved instance quickly shows up as latency across your whole system.
Both servers expose the same INFO statistics, so a single OpenTelemetry Collector receiver monitors Redis and Valkey alike.
This includes managed offerings that are compatible with them, as long as the collector can reach the instance and run the INFO command.
Use Cases
- Monitor memory usage, peak memory, and fragmentation before keys get evicted
- Track cache hit ratio from keyspace hits and misses
- Analyze command throughput and network traffic
- Monitor connected, blocked, and rejected client connections
- Track key evictions and expirations
- Monitor replication offsets and connected replicas
- Understand CPU time and memory fragmentation on each instance
Setup
Overview
Redis and Valkey report their statistics through the INFO command.
The OpenTelemetry Collector's Redis receiver runs INFO on each instance at a fixed interval and turns the result into redis.* metrics: memory, clients, commands, keyspace, CPU, persistence, and replication.
The receiver works the same way for Redis and Valkey, because Valkey keeps the INFO format of Redis.
Prerequisites
Before setting up Redis or Valkey monitoring, ensure:
- Redis or Valkey is running and reachable from the OpenTelemetry Collector (default port: 6379)
- You can create users with the
ACLcommand (Redis 6.0 or later, and Valkey), or you know therequirepasspassword (Redis before 6.0) - OpenTelemetry Collector is deployed in your environment using the OpenTelemetry Collector Contrib distribution .
You'll need an OpenTelemetry Collector deployed. Consider using:
Create a Monitoring User
The receiver only needs the INFO command.
Create a dedicated user that can run INFO and nothing else:
redis-cli ACL SETUSER dash0_monitor on '>secure_password' -@all +infoOn Valkey, run the same command with valkey-cli.
Persist the user with ACL SAVE if you use an ACL file, or add it to your configuration file, so it survives a restart:
user dash0_monitor on >secure_password -@all +infoCheck that the user can read the statistics:
redis-cli --user dash0_monitor --pass secure_password INFO serverOn Kubernetes, store the password in a Secret and expose it to the collector as an environment variable:
kubectl create secret generic redis-monitoring \
--namespace opentelemetry \
--from-literal=password='secure_password'Collector Configuration
The OpenTelemetry Collector uses the Redis receiver to collect metrics from Redis or Valkey. Add the following configuration to your collector:
receivers:
redis:
endpoint: redis.your-namespace.svc.cluster.local:6379
username: dash0_monitor
password: ${env:REDIS_PASSWORD}
collection_interval: 10s
resource_attributes:
# Identify each instance in Dash0
server.address:
enabled: true
server.port:
enabled: true
service:
pipelines:
metrics:
receivers: [redis]Enable the server.address and server.port resource attributes so you can tell instances apart.
They are disabled by default, and without them the only resource attribute the receiver sets is redis.version.
The Redis & Valkey Overview dashboard uses server.address for its Instance filter and to name each instance's series.
Environment Variables
Configure the following environment variable for the collector:
REDIS_PASSWORD: password of the monitoring user
Multiple Instances
The receiver reads a single instance. Add one named receiver per instance, including every primary and replica, and every node of a cluster:
receivers:
redis/primary:
endpoint: redis-primary.your-namespace.svc.cluster.local:6379
username: dash0_monitor
password: ${env:REDIS_PASSWORD}
resource_attributes:
server.address:
enabled: true
server.port:
enabled: true
redis/replica:
endpoint: redis-replica.your-namespace.svc.cluster.local:6379
username: dash0_monitor
password: ${env:REDIS_PASSWORD}
resource_attributes:
server.address:
enabled: true
server.port:
enabled: true
service:
pipelines:
metrics:
receivers: [redis/primary, redis/replica]For cluster mode, you can also enable the redis.cluster.* metrics, such as redis.cluster.state and redis.cluster.slots_fail.
TLS
If the instance requires TLS, disable insecure and point the receiver at your certificates:
receivers:
redis:
endpoint: redis.your-namespace.svc.cluster.local:6379
username: dash0_monitor
password: ${env:REDIS_PASSWORD}
tls:
insecure: false
ca_file: /etc/ssl/redis/ca.crtFor more options, see the Redis receiver documentation .
Verification
After configuring the collector, verify that metrics are being collected:
- Check the collector logs for
Error scraping metricsmessages from theredisreceiver - Navigate to the Metrics Explorer in Dash0
- Search for metrics with prefix
redis.* - Confirm key metrics are visible:
redis.memory.used(memory used by the server)redis.clients.connected(connected clients)redis.commands.processed(total commands processed)redis.keyspace.hitsandredis.keyspace.misses(cache lookups)redis.keys.evicted(keys evicted because of the memory limit)
