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 {
TotalReplicatedError prometheus.Counter
TotalSendAttempts prometheus.Counter
TotalFailedSendAttempts prometheus.Counter
FailedCacheHits *prometheus.CounterVec
TotalFailedCacheHits prometheus.Counter
}
func newMetrics() metrics {
......@@ -66,15 +66,12 @@ func newMetrics() metrics {
Name: "total_failed_send_attempts",
Help: "Total no of failed attempts to push chunk.",
}),
FailedCacheHits: prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: m.Namespace,
Subsystem: subsystem,
Name: "failed_cache_hits",
Help: "FailedRequestCache hits",
},
[]string{"peer", "chunk"},
),
TotalFailedCacheHits: prometheus.NewCounter(prometheus.CounterOpts{
Namespace: m.Namespace,
Subsystem: subsystem,
Name: "total_failed_cache_hits",
Help: "Total FailedRequestCache hits",
}),
}
}
......
......@@ -364,7 +364,7 @@ func (ps *PushSync) pushToClosest(ctx context.Context, ch swarm.Chunk, retryAllo
}
if !ps.failedRequests.Useful(peer, ch.Address()) {
skipPeers = append(skipPeers, peer)
ps.metrics.FailedCacheHits.WithLabelValues(peer.String(), ch.Address().String()).Inc()
ps.metrics.TotalFailedCacheHits.Inc()
continue
}
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