kafkaManager官方的解释如下
Producer offset is polled. Consumer offset is read from the offset topic for Kafka based consumers. This means the reported lag may be negative since we are consuming offset from the offset topic faster then polling the producer offset. This is normal and not a problem.
附链接:https://github.com/yahoo/CMAK
Producer 的 offset 是通过 JMX 轮询获得的,Consumer 的 offset 是从 kafka 内的 __consumer_offsets 的 topic 中直接读取到的,很明显轮询获取 offset 比 直接从 topic 拿 offset 慢一点,也就可能会出现 Lag 计算后为负数的情况。