From 7329bc23bc116b2740c310e1a94be4e9cfc11f23 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Thu, 2 May 2024 23:01:04 +0300 Subject: [PATCH] export lag for all partition, not only owned Signed-off-by: Vasiliy Tolstov --- subscriber.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/subscriber.go b/subscriber.go index 80d3587..472264b 100644 --- a/subscriber.go +++ b/subscriber.go @@ -106,10 +106,8 @@ func (s *subscriber) poll(ctx context.Context) { } s.Lock() - for tp := range s.consumers { - if v, ok := lmap[tp.p]; ok { - s.kopts.Meter.Counter(semconv.BrokerGroupLag, "topic", s.topic, "group", s.opts.Group, "partition", strconv.Itoa(int(tp.p)), "lag", strconv.Itoa(int(v.Lag))) - } + for p, l := range lmap { + s.kopts.Meter.Counter(semconv.BrokerGroupLag, "topic", s.topic, "group", s.opts.Group, "partition", strconv.Itoa(int(p)), "lag", strconv.Itoa(int(l.Lag))) } s.Unlock()