diff options
author | Anton Evangelatov <anton.evangelatov@gmail.com> | 2019-01-18 20:27:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-18 20:27:27 +0800 |
commit | a0b0db63055e1dd350215f9fe04b0abf19f3488a (patch) | |
tree | e1ceff2da2758ca46c87330bb9b9e235fcca5287 /cmd | |
parent | 632135ce4c1d8d3d9a36771aab4137260018e84b (diff) | |
download | go-tangerine-a0b0db63055e1dd350215f9fe04b0abf19f3488a.tar go-tangerine-a0b0db63055e1dd350215f9fe04b0abf19f3488a.tar.gz go-tangerine-a0b0db63055e1dd350215f9fe04b0abf19f3488a.tar.bz2 go-tangerine-a0b0db63055e1dd350215f9fe04b0abf19f3488a.tar.lz go-tangerine-a0b0db63055e1dd350215f9fe04b0abf19f3488a.tar.xz go-tangerine-a0b0db63055e1dd350215f9fe04b0abf19f3488a.tar.zst go-tangerine-a0b0db63055e1dd350215f9fe04b0abf19f3488a.zip |
cmd/swarm: use resetting timer to measure fetch time (#18474)
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/swarm/swarm-smoke/upload_and_sync.go | 8 |
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 d605f79a3..728975c36 100644 --- a/cmd/swarm/swarm-smoke/upload_and_sync.go +++ b/cmd/swarm/swarm-smoke/upload_and_sync.go @@ -125,30 +125,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 } |