From be36c9b787b463684a62c1a9c867c84a747aa500 Mon Sep 17 00:00:00 2001 From: Marcus Cobden Date: Wed, 8 Aug 2018 13:12:48 +0100 Subject: [PATCH] Add Jaeger initialisation for distributed tracing --- prog/app.go | 4 ++++ prog/probe.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/prog/app.go b/prog/app.go index fb5a6d29c2..e07fec1905 100644 --- a/prog/app.go +++ b/prog/app.go @@ -23,6 +23,7 @@ import ( "github.com/weaveworks/common/middleware" "github.com/weaveworks/common/network" "github.com/weaveworks/common/signals" + "github.com/weaveworks/common/tracing" "github.com/weaveworks/go-checkpoint" "github.com/weaveworks/scope/app" "github.com/weaveworks/scope/app/multitenant" @@ -202,6 +203,9 @@ func appMain(flags appFlags) { setLogFormatter(flags.logPrefix) runtime.SetBlockProfileRate(flags.blockProfileRate) + traceCloser := tracing.InitFromEnv() + defer traceCloser.Close() + defer log.Info("app exiting") rand.Seed(time.Now().UnixNano()) app.UniqueID = strconv.FormatInt(rand.Int63(), 16) diff --git a/prog/probe.go b/prog/probe.go index cf8683943b..7c2507af1e 100644 --- a/prog/probe.go +++ b/prog/probe.go @@ -18,6 +18,7 @@ import ( "github.com/weaveworks/common/network" "github.com/weaveworks/common/sanitize" "github.com/weaveworks/common/signals" + "github.com/weaveworks/common/tracing" "github.com/weaveworks/go-checkpoint" "github.com/weaveworks/scope/common/hostname" "github.com/weaveworks/scope/common/weave" @@ -93,6 +94,9 @@ func probeMain(flags probeFlags, targets []appclient.Target) { setLogLevel(flags.logLevel) setLogFormatter(flags.logPrefix) + traceCloser := tracing.InitFromEnv() + defer traceCloser.Close() + // Setup in memory metrics sink inm := metrics.NewInmemSink(time.Minute, 2*time.Minute) sig := metrics.DefaultInmemSignal(inm)