diff --git a/internal/monitor/metrics.go b/internal/monitor/metrics.go index 355fe42..4ba77a2 100644 --- a/internal/monitor/metrics.go +++ b/internal/monitor/metrics.go @@ -138,9 +138,12 @@ func positionMap(pos mysql.Position) map[string]interface{} { } func positionGap(master mysql.Position, checkpoint mysql.Position) interface{} { - if master.Name == "" || checkpoint.Name == "" || master.Name != checkpoint.Name || master.Pos < checkpoint.Pos { + if master.Name == "" || checkpoint.Name == "" || master.Name != checkpoint.Name { return nil } + if master.Pos < checkpoint.Pos { + return uint32(0) + } return master.Pos - checkpoint.Pos }