Skip to content

Commit 4625b12

Browse files
holisticodeskylenet
authored andcommitted
cmd/swarm/swarm-smoke: use ResettingTimer instead of Counters for times (ethereum#18479)
(cherry picked from commit 5609577)
1 parent 21d54bc commit 4625b12

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 {
@@ -166,8 +165,6 @@ func fetch(hash string, endpoint string, original []byte, ruid string) error {
166165
ctx, sp := spancontext.StartSpan(context.Background(), "upload-and-sync.fetch")
167166
defer sp.Finish()
168167

169-
log.Trace("sleeping", "ruid", ruid)
170-
time.Sleep(3 * time.Second)
171168
log.Trace("http get request", "ruid", ruid, "api", endpoint, "hash", hash)
172169

173170
var tn time.Time

0 commit comments

Comments
 (0)