Skip to content

Commit 14c1544

Browse files
committed
fix(ddtrace/internal): log to debug instead of warning when starting spans without an active tracer (#3513)
1 parent e3ceaf5 commit 14c1544

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ddtrace/internal/globaltracer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type NoopTracer struct{}
4747

4848
// StartSpan implements ddtrace.Tracer.
4949
func (NoopTracer) StartSpan(_ string, _ ...ddtrace.StartSpanOption) ddtrace.Span {
50-
log.Warn("Tracer must be started before starting a span; Review the docs for more information: https://docs.datadoghq.com/tracing/trace_collection/library_config/go/")
50+
log.Debug("Tracer must be started before starting a span; Review the docs for more information: https://docs.datadoghq.com/tracing/trace_collection/library_config/go/")
5151
return NoopSpan{}
5252
}
5353

ddtrace/tracer/tracer_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,6 +2708,9 @@ func TestNoopTracerStartSpan(t *testing.T) {
27082708
undo := log.UseLogger(customLogger{l: llog.New(w, "", llog.LstdFlags)})
27092709
defer undo()
27102710

2711+
log.SetLevel(log.LevelDebug)
2712+
defer log.SetLevel(log.LevelWarn)
2713+
27112714
StartSpan("abcd")
27122715

27132716
w.Close()

0 commit comments

Comments
 (0)