diff --git a/cmd/swarm/swarm-smoke/feed_upload_and_sync.go b/cmd/swarm/swarm-smoke/feed_upload_and_sync.go index b173e632f5..22fbc60f84 100644 --- a/cmd/swarm/swarm-smoke/feed_upload_and_sync.go +++ b/cmd/swarm/swarm-smoke/feed_upload_and_sync.go @@ -256,7 +256,7 @@ func feedUploadAndSync(c *cli.Context) error { ruid := uuid.New()[:8] go func(url string, endpoint string, ruid string) { for { - err := fetch(url, endpoint, fileHash, ruid) + err := fetch(url, endpoint, fileHash, ruid, "") if err != nil { continue } diff --git a/cmd/swarm/swarm-smoke/sliding_window.go b/cmd/swarm/swarm-smoke/sliding_window.go index 90fb2f6480..59711cfecf 100644 --- a/cmd/swarm/swarm-smoke/sliding_window.go +++ b/cmd/swarm/swarm-smoke/sliding_window.go @@ -90,7 +90,7 @@ outer: idx := 1 + rand.Intn(len(hosts)-1) ruid := uuid.New()[:8] start := time.Now() - err := fetch(v.hash, httpEndpoint(hosts[idx]), v.digest, ruid) + err := fetch(v.hash, httpEndpoint(hosts[idx]), v.digest, ruid, "") if err != nil { continue inner } diff --git a/cmd/swarm/swarm-smoke/upload_and_sync.go b/cmd/swarm/swarm-smoke/upload_and_sync.go index a5191f4d79..2b07bda950 100644 --- a/cmd/swarm/swarm-smoke/upload_and_sync.go +++ b/cmd/swarm/swarm-smoke/upload_and_sync.go @@ -35,7 +35,10 @@ import ( func uploadAndSync(c *cli.Context) error { seed := int(time.Now().UnixNano() / 1e6) - log.Info("uploading to "+httpEndpoint(hosts[0])+" and syncing", "seed", seed) + // test uuid + tuid := uuid.New()[:8] + + log.Info("uploading to "+httpEndpoint(hosts[0])+" and syncing", "tuid", tuid, "seed", seed) h := md5.New() r := io.TeeReader(io.LimitReader(crand.Reader, int64(filesize*1000)), h) @@ -46,11 +49,12 @@ func uploadAndSync(c *cli.Context) error { log.Error(err.Error()) return err } - metrics.GetOrRegisterResettingTimer("upload-and-sync.upload-time", nil).UpdateSince(t1) + t2 := time.Since(t1) + metrics.GetOrRegisterResettingTimer("upload-and-sync.upload-time", nil).Update(t2) fhash := h.Sum(nil) - log.Info("uploaded successfully", "hash", hash, "digest", fmt.Sprintf("%x", fhash)) + log.Info("uploaded successfully", "tuid", tuid, "hash", hash, "took", t2, "digest", fmt.Sprintf("%x", fhash)) time.Sleep(time.Duration(syncDelay) * time.Second) @@ -63,12 +67,14 @@ func uploadAndSync(c *cli.Context) error { go func(endpoint string, ruid string) { for { start := time.Now() - err := fetch(hash, endpoint, fhash, ruid) + err := fetch(hash, endpoint, fhash, ruid, tuid) if err != nil { continue } + ended := time.Since(start) - metrics.GetOrRegisterResettingTimer("upload-and-sync.single.fetch-time", nil).UpdateSince(start) + metrics.GetOrRegisterResettingTimer("upload-and-sync.single.fetch-time", nil).Update(ended) + log.Info("fetch successful", "tuid", tuid, "ruid", ruid, "took", ended, "endpoint", endpoint) wg.Done() return } @@ -80,12 +86,14 @@ func uploadAndSync(c *cli.Context) error { go func(endpoint string, ruid string) { for { start := time.Now() - err := fetch(hash, endpoint, fhash, ruid) + err := fetch(hash, endpoint, fhash, ruid, tuid) if err != nil { continue } + ended := time.Since(start) - metrics.GetOrRegisterResettingTimer("upload-and-sync.each.fetch-time", nil).UpdateSince(start) + metrics.GetOrRegisterResettingTimer("upload-and-sync.each.fetch-time", nil).Update(ended) + log.Info("fetch successful", "tuid", tuid, "ruid", ruid, "took", ended, "endpoint", endpoint) wg.Done() return } diff --git a/cmd/swarm/swarm-smoke/util.go b/cmd/swarm/swarm-smoke/util.go index becb50266a..8983710619 100644 --- a/cmd/swarm/swarm-smoke/util.go +++ b/cmd/swarm/swarm-smoke/util.go @@ -154,11 +154,11 @@ func fetchFeed(topic string, user string, endpoint string, original []byte, ruid } // fetch is getting the requested `hash` from the `endpoint` and compares it with the `original` file -func fetch(hash string, endpoint string, original []byte, ruid string) error { +func fetch(hash string, endpoint string, original []byte, ruid string, tuid string) error { ctx, sp := spancontext.StartSpan(context.Background(), "upload-and-sync.fetch") defer sp.Finish() - log.Trace("http get request", "ruid", ruid, "api", endpoint, "hash", hash) + log.Info("http get request", "tuid", tuid, "ruid", ruid, "endpoint", endpoint, "hash", hash) var tn time.Time reqUri := endpoint + "/bzz:/" + hash + "/" @@ -182,7 +182,7 @@ func fetch(hash string, endpoint string, original []byte, ruid string) error { log.Error(err.Error(), "ruid", ruid) return err } - log.Trace("http get response", "ruid", ruid, "api", endpoint, "hash", hash, "code", res.StatusCode, "len", res.ContentLength) + log.Info("http get response", "tuid", tuid, "ruid", ruid, "endpoint", endpoint, "hash", hash, "code", res.StatusCode, "len", res.ContentLength) if res.StatusCode != 200 { err := fmt.Errorf("expected status code %d, got %v", 200, res.StatusCode)