aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Evangelatov <anton.evangelatov@gmail.com>2019-01-18 20:27:27 +0800
committerRafael Matias <rafael@skyle.net>2019-02-19 19:56:30 +0800
commit878aa58ec66ffc541a80aa65ee35261efa086c9c (patch)
tree3ed583eefaa8b44f6eb62c36722a5b7314bd1392
parent475a0664c5d58e7f50d5253915dd7ce5707b6e70 (diff)
downloaddexon-878aa58ec66ffc541a80aa65ee35261efa086c9c.tar.gz
dexon-878aa58ec66ffc541a80aa65ee35261efa086c9c.tar.zst
dexon-878aa58ec66ffc541a80aa65ee35261efa086c9c.zip
cmd/swarm: use resetting timer to measure fetch time (#18474)
(cherry picked from commit a0b0db63055e1dd350215f9fe04b0abf19f3488a)
-rw-r--r--cmd/swarm/swarm-smoke/upload_and_sync.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/cmd/swarm/swarm-smoke/upload_and_sync.go b/cmd/swarm/swarm-smoke/upload_and_sync.go
index 6b26b152d..7babc8004 100644
--- a/cmd/swarm/swarm-smoke/upload_and_sync.go
+++ b/cmd/swarm/swarm-smoke/upload_and_sync.go
@@ -124,30 +124,28 @@ func uploadAndSync(c *cli.Context) error {
for {
start := time.Now()
err := fetch(hash, endpoint, fhash, ruid)
- fetchTime := time.Since(start)
if err != nil {
continue
}
- metrics.GetOrRegisterMeter("upload-and-sync.single.fetch-time", nil).Mark(int64(fetchTime))
+ metrics.GetOrRegisterResettingTimer("upload-and-sync.single.fetch-time", nil).UpdateSince(start)
wg.Done()
return
}
}(endpoints[randIndex], ruid)
} else {
- for _, endpoint := range endpoints {
+ for _, endpoint := range endpoints[1:] {
ruid := uuid.New()[:8]
wg.Add(1)
go func(endpoint string, ruid string) {
for {
start := time.Now()
err := fetch(hash, endpoint, fhash, ruid)
- fetchTime := time.Since(start)
if err != nil {
continue
}
- metrics.GetOrRegisterMeter("upload-and-sync.each.fetch-time", nil).Mark(int64(fetchTime))
+ metrics.GetOrRegisterResettingTimer("upload-and-sync.each.fetch-time", nil).UpdateSince(start)
wg.Done()
return
}