accounting: fix Prometheus metrics to be the same as core/stats

In 04aa6969a4 we updated the displayed speed to be a rolling
average in core/stats and the progress output but we didn't update the
Prometheus metrics.

This patch updates the Prometheus metrics too.

Fixes #7053
This commit is contained in:
Nick Craig-Wood 2023-06-12 17:42:29 +01:00
parent 055206c4ee
commit 45255bccb3

View file

@ -135,13 +135,7 @@ func (s *StatsInfo) RemoteStats() (out rc.Params, err error) {
//
// Call with lock held
func (s *StatsInfo) speed() float64 {
dt := s.totalDuration()
dtSeconds := dt.Seconds()
speed := 0.0
if dt > 0 {
speed = float64(s.bytes) / dtSeconds
}
return speed
return s.average.speed
}
// timeRange is a start and end time of a transfer