Skip to content

Commit 8bc165b

Browse files
authored
Remove UseDatadog from tracing config (#272)
This was introduced in #247 to allow applications to use the datadog tracing api directly instead of an opentracing compatible version. The issue is that when `UseDatadog` is enabled, opentracing.GlobalTracer is set to a noop tracer so other packages in netlify-commons that emit traces (e.g router) don't work as expected. We don't actually need this option because `opentracer.New` already calls `tracer.Start` so applications should be able to use both the opentracing and datadog tracing api.
1 parent 6386f12 commit 8bc165b

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

tracing/config.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ type Config struct {
2121
Port string `default:"8126"`
2222
Tags map[string]string
2323
EnableDebug bool `default:"false" split_words:"true" mapstructure:"enable_debug" json:"enable_debug" yaml:"enable_debug"`
24-
UseDatadog bool `default:"false" split_words:"true" mapstructure:"use_datadog" json:"use_datadog" yaml:"use_datadog"`
2524
}
2625

2726
func Configure(tc *Config, log logrus.FieldLogger, svcName string) {
@@ -35,12 +34,6 @@ func Configure(tc *Config, log logrus.FieldLogger, svcName string) {
3534
tracer.WithLogger(debugLogger{log.WithField("component", "opentracing")}),
3635
}
3736

38-
if tc.UseDatadog {
39-
tracerOps = append(tracerOps, tracer.WithLogger(debugLogger{log.WithField("component", "datadog")}))
40-
} else {
41-
tracerOps = append(tracerOps, tracer.WithLogger(debugLogger{log.WithField("component", "opentracing")}))
42-
}
43-
4437
var serviceTagSet bool
4538
for k, v := range tc.Tags {
4639
if strings.ToLower(k) == "service" {
@@ -54,11 +47,7 @@ func Configure(tc *Config, log logrus.FieldLogger, svcName string) {
5447
tracerOps = append(tracerOps, tracer.WithGlobalTag("service", svcName))
5548
}
5649

57-
if tc.UseDatadog {
58-
tracer.Start(tracerOps...)
59-
} else {
60-
t = opentracer.New(tracerOps...)
61-
}
50+
t = opentracer.New(tracerOps...)
6251
}
6352
opentracing.SetGlobalTracer(t)
6453
}

0 commit comments

Comments
 (0)