From 78e8e179c502e32f1abcb5d8e3b869a47037fc45 Mon Sep 17 00:00:00 2001 From: istae <14264581+istae@users.noreply.github.com> Date: Sat, 23 Sep 2023 12:28:48 +0300 Subject: [PATCH] fix: metrics --- pkg/pullsync/metrics.go | 7 +++++++ pkg/pullsync/pullsync.go | 1 + 2 files changed, 8 insertions(+) diff --git a/pkg/pullsync/metrics.go b/pkg/pullsync/metrics.go index fd7aa8fb921..45511d1bf37 100644 --- a/pkg/pullsync/metrics.go +++ b/pkg/pullsync/metrics.go @@ -12,6 +12,7 @@ import ( type metrics struct { Offered prometheus.Counter // number of chunks offered Wanted prometheus.Counter // number of chunks wanted + MissingChunks prometheus.Counter // number of reserve get errs Delivered prometheus.Counter // number of chunk deliveries Sent prometheus.Counter // number of chunks sent DuplicateRuid prometheus.Counter // number of duplicate RUID requests we got @@ -34,6 +35,12 @@ func newMetrics() metrics { Name: "chunks_wanted", Help: "Total chunks wanted.", }), + MissingChunks: prometheus.NewCounter(prometheus.CounterOpts{ + Namespace: m.Namespace, + Subsystem: subsystem, + Name: "missing_chunks", + Help: "Total reserve get errors.", + }), Delivered: prometheus.NewCounter(prometheus.CounterOpts{ Namespace: m.Namespace, Subsystem: subsystem, diff --git a/pkg/pullsync/pullsync.go b/pkg/pullsync/pullsync.go index e3e2cba217b..efefe984e0f 100644 --- a/pkg/pullsync/pullsync.go +++ b/pkg/pullsync/pullsync.go @@ -474,6 +474,7 @@ func (s *Syncer) processWant(ctx context.Context, o *pb.Offer, w *pb.Want) ([]sw if err != nil { s.logger.Error(err, "processing want: unable to find chunk", "chunk_address", addr, "batch_id", ch.BatchID) chunks = append(chunks, swarm.NewChunk(swarm.ZeroAddress, nil)) + s.metrics.MissingChunks.Inc() continue } chunks = append(chunks, c)