From c2bacbc9593c36796369b80332f65945ab93c551 Mon Sep 17 00:00:00 2001 From: sundy-li <543950155@qq.com> Date: Tue, 26 Feb 2019 11:35:34 +0800 Subject: [PATCH] Force lag to -1 when offset is equal to -1 ISSUES #14 --- monitor/importer.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/monitor/importer.go b/monitor/importer.go index 0e0310a..9536902 100644 --- a/monitor/importer.go +++ b/monitor/importer.go @@ -68,6 +68,9 @@ func (i *Importer) start() { "offsize": entry.Offset, "lag": entry.Logsize - entry.Offset, } + if entry.Offset < 0 { + fields["lag"] = -1 + } tm := time.Unix(msg.Timestamp/1000, 0) pt, err := client.NewPoint("consumer_metrics", tags, fields, tm)