Skip to content

Commit

Permalink
Move tracing config to m3x
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmains12 committed Jan 28, 2019
1 parent 2178963 commit 19f521d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
3 changes: 1 addition & 2 deletions src/cmd/services/m3query/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"time"

etcdclient "github.com/m3db/m3/src/cluster/client/etcd"
jaegercfg "github.com/uber/jaeger-client-go/config"

"github.com/m3db/m3/src/cmd/services/m3coordinator/downsample"
"github.com/m3db/m3/src/cmd/services/m3coordinator/ingest"
Expand Down Expand Up @@ -52,7 +51,7 @@ type Configuration struct {
// Metrics configuration.
Metrics instrument.MetricsConfiguration `yaml:"metrics"`

Tracing jaegercfg.Configuration `yaml:"tracing"`
Tracing instrument.TracingConfiguration `yaml:"tracing"`

// Clusters is the DB cluster configurations for read, write and
// query endpoints.
Expand Down
3 changes: 1 addition & 2 deletions src/query/config/m3query-dev-etcd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,4 @@ limits:
maxFetchedDatapoints: 500000000

tracing:
reporter:
logSpans: true
backend: jaeger
32 changes: 17 additions & 15 deletions src/query/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,17 @@ import (
xsync "github.com/m3db/m3x/sync"
xtime "github.com/m3db/m3x/time"

"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
"github.com/uber-go/tally"
jaegercfg "github.com/uber/jaeger-client-go/config"
jaegerzap "github.com/uber/jaeger-client-go/log/zap"
jaegertally "github.com/uber/jaeger-lib/metrics/tally"
"go.uber.org/zap"
"google.golang.org/grpc"
)

const (
serviceName = "m3query"
)

var (
defaultLocalConfiguration = &config.LocalConfiguration{
Namespace: "default",
Expand Down Expand Up @@ -128,22 +130,22 @@ func Run(runOpts RunOptions) {
if err != nil {
logger.Fatal("could not connect to metrics", zap.Any("error", err))
}
instrumentOptions := instrument.NewOptions().
SetMetricsScope(scope).
SetZapLogger(logger)

jaegerLog := jaegerzap.NewLogger(logger)
jaegerCloser, err := cfg.Tracing.InitGlobalTracer("m3query",
// nix this
// jaegercfg.Reporter(jaeger.NewCompositeReporter(jaeger.NewLoggingReporter(jaegerLog), jaeger.NewRemoteReporter()),
tracer, traceCloser, err := cfg.Tracing.NewTracer(serviceName, scope, logger)
if err != nil {
logger.Fatal("could not initialize tracing", zap.Error(err))
}

jaegercfg.Logger(jaegerLog),
jaegercfg.Metrics(jaegertally.Wrap(scope)))
defer traceCloser.Close()

if err != nil {
logger.Fatal("could not initialize Jaeger")
if _, ok := tracer.(opentracing.NoopTracer); ok {
logger.Info("tracing disabled; set `tracing.backend` to enable")
}
defer jaegerCloser.Close()

instrumentOptions := instrument.NewOptions().
SetMetricsScope(scope).
SetZapLogger(logger).
SetTracer(tracer)

// Close metrics scope
defer func() {
Expand Down

0 comments on commit 19f521d

Please sign in to comment.