$npx -y skills add redis/agent-skills --skill redis-observabilityRedis observability guidance — which metrics to monitor (memory, connections, hit ratio, ops/sec, rejected connections), which built-in commands to reach for during incident triage (SLOWLOG, INFO, MEMORY DOCTOR, CLIENT LIST, FT.PROFILE), and when to use the Redis Insight GUI. Use
| 1 | # Redis Observability |
| 2 | |
| 3 | What to watch, what to run, and what to alert on. Covers the metrics every Redis deployment should monitor and the built-in commands for ad-hoc diagnosis. |
| 4 | |
| 5 | ## When to apply |
| 6 | |
| 7 | - Setting up monitoring or alerts for a Redis instance. |
| 8 | - Diagnosing a Redis performance regression (high latency, memory pressure, connection storms). |
| 9 | - Profiling a slow `FT.SEARCH` or pipeline. |
| 10 | - Wiring Redis metrics into Prometheus, Datadog, CloudWatch, or similar. |
| 11 | |
| 12 | ## 1. Monitor these metrics |
| 13 | |
| 14 | These come from `INFO` and should be exported to your monitoring system. |
| 15 | |
| 16 | | Metric | What it tells you | Alert when | |
| 17 | |---|---|---| |
| 18 | | `used_memory` | Current memory usage | > 80% of `maxmemory` | |
| 19 | | `connected_clients` | Open connections | Sudden spikes or drops | |
| 20 | | `blocked_clients` | Clients waiting on blocking ops | > 0 sustained | |
| 21 | | `instantaneous_ops_per_sec` | Current throughput | Significant drops | |
| 22 | | `keyspace_hits` / `keyspace_misses` | Cache hit ratio | Hit ratio < 80% | |
| 23 | | `rejected_connections` | Hit `maxclients` cap | > 0 | |
| 24 | | `rdb_last_save_time` | Last persistence snapshot | Too old vs. RPO | |
| 25 | |
| 26 | ```python |
| 27 | info = redis.info() |
| 28 | hit_ratio = info["keyspace_hits"] / max(1, info["keyspace_hits"] + info["keyspace_misses"]) |
| 29 | print(f"Memory: {info['used_memory_human']}") |
| 30 | print(f"Clients: {info['connected_clients']}") |
| 31 | print(f"Ops/sec: {info['instantaneous_ops_per_sec']}") |
| 32 | print(f"Hit ratio: {hit_ratio:.1%}") |
| 33 | ``` |
| 34 | |
| 35 | See [references/metrics.md](references/metrics.md). |
| 36 | |
| 37 | ## 2. Built-in commands for debugging |
| 38 | |
| 39 | Reach for these when something looks off. |
| 40 | |
| 41 | | Topic | Command | |
| 42 | |---|---| |
| 43 | | Slow commands | `SLOWLOG GET 10` / `SLOWLOG LEN` / `SLOWLOG RESET` | |
| 44 | | Server snapshot | `INFO all` (or `INFO memory` / `INFO stats` / `INFO clients` / `INFO replication`) | |
| 45 | | Memory diagnostics | `MEMORY DOCTOR` / `MEMORY STATS` / `MEMORY USAGE <key>` | |
| 46 | | Connections | `CLIENT LIST` / `CLIENT INFO` | |
| 47 | | RQE / Search | `FT.INFO <idx>` / `FT.PROFILE <idx> SEARCH QUERY "..."` | |
| 48 | |
| 49 | The two most useful for incident triage: |
| 50 | |
| 51 | - **`SLOWLOG GET`** to find queries that exceeded the `slowlog-log-slower-than` threshold (10ms by default). The output shows the exact command and duration in microseconds. |
| 52 | - **`MEMORY DOCTOR`** for memory pressure — it returns a one-paragraph summary of what's unusual about memory usage right now. |
| 53 | |
| 54 | ```python |
| 55 | for entry in redis.slowlog_get(10): |
| 56 | print(f"{entry['duration']}μs {entry['command']}") |
| 57 | ``` |
| 58 | |
| 59 | See [references/commands.md](references/commands.md). |
| 60 | |
| 61 | ## 3. Redis Insight |
| 62 | |
| 63 | For interactive use (running queries, browsing keys, profiling indexes), [Redis Insight](https://redis.io/insight/) is the official GUI. It surfaces the same `SLOWLOG` / `INFO` / `FT.PROFILE` data visually and includes Redis Copilot for natural-language queries. Useful during development and incident response; not a replacement for exporting metrics to your monitoring system. |
| 64 | |
| 65 | ## References |
| 66 | |
| 67 | - [Redis: Latency monitoring](https://redis.io/docs/latest/operate/oss_and_stack/management/optimization/latency/) |
| 68 | - [Redis Insight](https://redis.io/insight/) |