Skip to content

Commit 5609577

Browse files
holisticodenonsense
authored andcommitted
cmd/swarm/swarm-smoke: use ResettingTimer instead of Counters for times (ethereum#18479)
1 parent a0b0db6 commit 5609577

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

cmd/swarm/swarm-smoke/upload_and_sync.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,8 @@ func cliUploadAndSync(c *cli.Context) error {
8686
func uploadAndSync(c *cli.Context) error {
8787
defer func(now time.Time) {
8888
totalTime := time.Since(now)
89-
9089
log.Info("total time", "time", totalTime, "kb", filesize)
91-
metrics.GetOrRegisterCounter("upload-and-sync.total-time", nil).Inc(int64(totalTime))
90+
metrics.GetOrRegisterResettingTimer("upload-and-sync.total-time", nil).Update(totalTime)
9291
}(time.Now())
9392

9493
generateEndpoints(scheme, cluster, appName, from, to)
@@ -103,7 +102,7 @@ func uploadAndSync(c *cli.Context) error {
103102
log.Error(err.Error())
104103
return err
105104
}
106-
metrics.GetOrRegisterCounter("upload-and-sync.upload-time", nil).Inc(int64(time.Since(t1)))
105+
metrics.GetOrRegisterResettingTimer("upload-and-sync.upload-time", nil).UpdateSince(t1)
107106

108107
fhash, err := digest(bytes.NewReader(randomBytes))
109108
if err != nil {
@@ -164,8 +163,6 @@ func fetch(hash string, endpoint string, original []byte, ruid string) error {
164163
ctx, sp := spancontext.StartSpan(context.Background(), "upload-and-sync.fetch")
165164
defer sp.Finish()
166165

167-
log.Trace("sleeping", "ruid", ruid)
168-
time.Sleep(3 * time.Second)
169166
log.Trace("http get request", "ruid", ruid, "api", endpoint, "hash", hash)
170167

171168
var tn time.Time

0 commit comments

Comments
 (0)