From 7c9314f231a7ddffbbbc5fec16c65519a0121eeb Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Fri, 13 Jul 2018 17:40:28 +0200 Subject: swarm: integrate OpenTracing; propagate ctx to internal APIs (#17169) * swarm: propagate ctx, enable opentracing * swarm/tracing: log error when tracing is misconfigured --- cmd/swarm/main.go | 3 +++ cmd/swarm/swarm-smoke/upload_and_sync.go | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/swarm/main.go b/cmd/swarm/main.go index 7a058b0cb..5b0767951 100644 --- a/cmd/swarm/main.go +++ b/cmd/swarm/main.go @@ -43,6 +43,7 @@ import ( "github.com/ethereum/go-ethereum/swarm" bzzapi "github.com/ethereum/go-ethereum/swarm/api" swarmmetrics "github.com/ethereum/go-ethereum/swarm/metrics" + "github.com/ethereum/go-ethereum/swarm/tracing" "gopkg.in/urfave/cli.v1" ) @@ -430,12 +431,14 @@ pv(1) tool to get a progress bar: app.Flags = append(app.Flags, rpcFlags...) app.Flags = append(app.Flags, debug.Flags...) app.Flags = append(app.Flags, swarmmetrics.Flags...) + app.Flags = append(app.Flags, tracing.Flags...) app.Before = func(ctx *cli.Context) error { runtime.GOMAXPROCS(runtime.NumCPU()) if err := debug.Setup(ctx, ""); err != nil { return err } swarmmetrics.Setup(ctx) + tracing.Setup(ctx) return nil } app.After = func(ctx *cli.Context) error { diff --git a/cmd/swarm/swarm-smoke/upload_and_sync.go b/cmd/swarm/swarm-smoke/upload_and_sync.go index b914eecd8..d5300b63d 100644 --- a/cmd/swarm/swarm-smoke/upload_and_sync.go +++ b/cmd/swarm/swarm-smoke/upload_and_sync.go @@ -77,8 +77,9 @@ func cliUploadAndSync(c *cli.Context) error { log.Info("uploaded successfully", "hash", hash, "digest", fmt.Sprintf("%x", fhash)) if filesize < 10 { - time.Sleep(15 * time.Second) + time.Sleep(35 * time.Second) } else { + time.Sleep(15 * time.Second) time.Sleep(2 * time.Duration(filesize) * time.Second) } @@ -108,7 +109,7 @@ func cliUploadAndSync(c *cli.Context) error { // 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 { log.Trace("sleeping", "ruid", ruid) - time.Sleep(1 * time.Second) + time.Sleep(5 * time.Second) log.Trace("http get request", "ruid", ruid, "api", endpoint, "hash", hash) res, err := http.Get(endpoint + "/bzz:/" + hash + "/") -- cgit v1.2.3