From bc60bc6bff7a11bba08c1408e0cb0d4dfef61592 Mon Sep 17 00:00:00 2001 From: Vladimir Varankin Date: Wed, 22 Jan 2025 14:33:45 +0100 Subject: [PATCH] grafananet: fix FlushSize metric Signed-off-by: Vladimir Varankin --- route/grafananet.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/route/grafananet.go b/route/grafananet.go index 7ee130b2..2312af94 100644 --- a/route/grafananet.go +++ b/route/grafananet.go @@ -18,17 +18,19 @@ import ( "github.com/Dieterbe/go-metrics" "github.com/golang/snappy" + "github.com/jpillora/backoff" + log "github.com/sirupsen/logrus" + dest "github.com/grafana/carbon-relay-ng/destination" "github.com/grafana/carbon-relay-ng/matcher" "github.com/grafana/carbon-relay-ng/persister" "github.com/grafana/carbon-relay-ng/stats" "github.com/grafana/carbon-relay-ng/util" - "github.com/jpillora/backoff" - log "github.com/sirupsen/logrus" - conf "github.com/grafana/carbon-relay-ng/pkg/mt-conf" "github.com/grafana/metrictank/schema" "github.com/grafana/metrictank/schema/msg" + + conf "github.com/grafana/carbon-relay-ng/pkg/mt-conf" ) type GrafanaNetConfig struct { @@ -338,9 +340,9 @@ func (route *GrafanaNet) retryFlush(metrics []*schema.MetricData, buffer *bytes. // re-instantiate body, since the previous .Do() attempt would have Read it all the way req.Body = ioutil.NopCloser(bytes.NewReader(body)) } - log.Debugf("GrafanaNet sent metrics in %s -msg size %d", dur, len(metrics)) + log.Debugf("GrafanaNet sent %d metrics in %s -msg size %d", len(metrics), dur, len(metrics)) route.durationTickFlush.Update(dur) - route.tickFlushSize.Update(int64(len(metrics))) + route.tickFlushSize.Update(int64(len(body))) return metrics[:0] }