Redis Observability

作者 redisa84871d065f3MIT收录于 2026年10月8日更新于 2026年10月8日

Redis 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 when setting up monitoring or alerts for a Redis instance, diagnosing a performance regression, profiling a slow FT.SEARCH query, or wiring Redis metrics into Prometheus, Datadog, or similar.

仅含说明DevOps & Cloud
AI 生成的概览

Redis 可观测性指南:应监控哪些指标、排查时使用哪些内置命令,以及何时使用 Redis Insight。

功能
该技能为观察 Redis 部署提供参考指导。它列出应从 INFO 导出的指标(内存、连接数、命中率、每秒操作数、被拒绝连接、持久化)并给出建议的告警阈值,同时汇总用于故障排查的内置诊断命令,如 SLOWLOG、INFO、MEMORY DOCTOR、CLIENT LIST 和 FT.PROFILE。它还说明何时适合使用 Redis Insight 图形界面,并指向关于指标和命令的两个参考文件。
适用场景
适用于为 Redis 实例设置监控或告警、诊断性能退化(如高延迟、内存压力或连接风暴)、分析缓慢的 FT.SEARCH 查询,或将 Redis 指标接入 Prometheus、Datadog、CloudWatch 等系统。
运行要求
不附带脚本,仅为说明与参考文档。应用这些指导需要可访问的 Redis 实例;若要导出指标,还需要 Prometheus、Datadog 或 CloudWatch 等监控系统。

Redis Observability

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.

When to apply

  • Setting up monitoring or alerts for a Redis instance.
  • Diagnosing a Redis performance regression (high latency, memory pressure, connection storms).
  • Profiling a slow FT.SEARCH or pipeline.
  • Wiring Redis metrics into Prometheus, Datadog, CloudWatch, or similar.

1. Monitor these metrics

These come from INFO and should be exported to your monitoring system.

MetricWhat it tells youAlert when
used_memoryCurrent memory usage> 80% of maxmemory
connected_clientsOpen connectionsSudden spikes or drops
blocked_clientsClients waiting on blocking ops> 0 sustained
instantaneous_ops_per_secCurrent throughputSignificant drops
keyspace_hits / keyspace_missesCache hit ratioHit ratio < 80%
rejected_connectionsHit maxclients cap> 0
rdb_last_save_timeLast persistence snapshotToo old vs. RPO
python
info = redis.info()hit_ratio = info["keyspace_hits"] / max(1, info["keyspace_hits"] + info["keyspace_misses"])print(f"Memory:    {info['used_memory_human']}")print(f"Clients:   {info['connected_clients']}")print(f"Ops/sec:   {info['instantaneous_ops_per_sec']}")print(f"Hit ratio: {hit_ratio:.1%}")

See references/metrics.md [blocked].

2. Built-in commands for debugging

Reach for these when something looks off.

TopicCommand
Slow commandsSLOWLOG GET 10 / SLOWLOG LEN / SLOWLOG RESET
Server snapshotINFO all (or INFO memory / INFO stats / INFO clients / INFO replication)
Memory diagnosticsMEMORY DOCTOR / MEMORY STATS / MEMORY USAGE <key>
ConnectionsCLIENT LIST / CLIENT INFO
RQE / SearchFT.INFO <idx> / FT.PROFILE <idx> SEARCH QUERY "..."

The two most useful for incident triage:

  • 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.
  • MEMORY DOCTOR for memory pressure — it returns a one-paragraph summary of what's unusual about memory usage right now.
python
for entry in redis.slowlog_get(10):    print(f"{entry['duration']}μs  {entry['command']}")

See references/commands.md [blocked].

3. Redis Insight

For interactive use (running queries, browsing keys, profiling indexes), Redis 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.

References

来源与署名

来源:redis/agent-skills位于plugins/redis-development/skills/redis-observability提交a84871d

许可证: MIT

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架