Commit dbfd7452 authored by Alok Nerurkar's avatar Alok Nerurkar Committed by GitHub

refactor: change FailedCacheHits to Counter (#1748)

parent cf386c9d
...@@ -17,7 +17,7 @@ type metrics struct { ...@@ -17,7 +17,7 @@ type metrics struct {
TotalReplicatedError prometheus.Counter TotalReplicatedError prometheus.Counter
TotalSendAttempts prometheus.Counter TotalSendAttempts prometheus.Counter
TotalFailedSendAttempts prometheus.Counter TotalFailedSendAttempts prometheus.Counter
FailedCacheHits *prometheus.CounterVec TotalFailedCacheHits prometheus.Counter
} }
func newMetrics() metrics { func newMetrics() metrics {
...@@ -66,15 +66,12 @@ func newMetrics() metrics { ...@@ -66,15 +66,12 @@ func newMetrics() metrics {
Name: "total_failed_send_attempts", Name: "total_failed_send_attempts",
Help: "Total no of failed attempts to push chunk.", Help: "Total no of failed attempts to push chunk.",
}), }),
FailedCacheHits: prometheus.NewCounterVec( TotalFailedCacheHits: prometheus.NewCounter(prometheus.CounterOpts{
prometheus.CounterOpts{ Namespace: m.Namespace,
Namespace: m.Namespace, Subsystem: subsystem,
Subsystem: subsystem, Name: "total_failed_cache_hits",
Name: "failed_cache_hits", Help: "Total FailedRequestCache hits",
Help: "FailedRequestCache hits", }),
},
[]string{"peer", "chunk"},
),
} }
} }
......
...@@ -364,7 +364,7 @@ func (ps *PushSync) pushToClosest(ctx context.Context, ch swarm.Chunk, retryAllo ...@@ -364,7 +364,7 @@ func (ps *PushSync) pushToClosest(ctx context.Context, ch swarm.Chunk, retryAllo
} }
if !ps.failedRequests.Useful(peer, ch.Address()) { if !ps.failedRequests.Useful(peer, ch.Address()) {
skipPeers = append(skipPeers, peer) skipPeers = append(skipPeers, peer)
ps.metrics.FailedCacheHits.WithLabelValues(peer.String(), ch.Address().String()).Inc() ps.metrics.TotalFailedCacheHits.Inc()
continue continue
} }
skipPeers = append(skipPeers, peer) skipPeers = append(skipPeers, peer)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment