Kafka 可观测性仪表盘

模拟实时 Grafana 风格指标 · 故障注入 · 根因决策树

Cluster: prod-1 3 brokers · 5 topics · 2 consumer groups
OfflinePartitions: 0
UnderReplicated: 0
ActiveController: 1
UncleanElection: 0/s

MessagesInPerSec

0msg/s

BytesInPerSec

0KB/s

BytesOutPerSec

0KB/s

RequestHandlerIdle %

0%

Consumer Lag (max)

0

ISR Shrink/s

0

实时趋势(每秒采样,最近 60 个点)

故障注入面板

根因决策树(指标 → 可能原因)

📍 OfflinePartitionsCount > 0
└─ 立刻看 controller.log
└─ 多个 Broker 同时宕:磁盘 / 电源 / 机房网络
└─ Controller 异常:选举循环、ZK/KRaft 通信失败
📍 UnderReplicatedPartitions > 0 持续 5 分钟
├─ 检查 ReplicaFetcher Lag → Follower 跟不上
├─ 网络限流:调 replica.fetch.max.bytes
├─ Follower GC 暂停:调 JVM
└─ 磁盘满 / 慢:换盘或迁移分区
└─ Broker 宕机:拉起或人工切 Leader
📍 RequestHandlerIdle < 20%
└─ I/O 线程不够 → num.io.threads 翻倍
📍 Consumer Lag 暴涨
├─ 上游写入暴涨 → 看 MessagesInPerSec
├─ 消费者 Rebalance 频繁 → 调 max.poll.interval.ms
└─ 业务处理慢 → 看应用 / DB / 外部调用
📍 ISR 频繁抖动 (Shrink+Expand 配对)
├─ 跨机房网络抖动 → 调 replica.lag.time.max.ms
└─ Follower GC / 磁盘 IO 间歇性卡
📍 UncleanLeaderElectionsPerSec > 0
└─ 已发生数据丢失!立刻确认是否误开 unclean.leader.election.enable