tracer: Log a warning on NoopTracer.StartSpan()#2991
Conversation
|
I cannot access gitlab so I'm not sure if the failure is significant. |
|
@mtoffl01 It actually looks relevant: I guess it's just a matter of starting the tracer properly in that benchmark. |
|
Moving this to draft while I work on gitlab access. |
Datadog ReportBranch report: ✅ 0 Failed, 5113 Passed, 70 Skipped, 2m 40.23s Total Time |
BenchmarksBenchmark execution time: 2025-04-03 17:46:30 Comparing candidate commit 69e63be in PR branch Found 0 performance improvements and 3 performance regressions! Performance is the same for 58 metrics, 1 unstable metrics. scenario:BenchmarkStartRequestSpan-24
|
|
@mtoffl01 We should fix the benchmarks' issue before merging, as these logging statements have a small impact and in benchmarks add up very quickly. |
Datadog ReportBranch report: ✅ 0 Failed, 5505 Passed, 72 Skipped, 3m 5.73s Total Time |
|
Benchmark results are caused by the logger's usage of As the release branch for |
Co-authored-by: Mikayla Toffler <[email protected]>
Co-authored-by: Mikayla Toffler <[email protected]>
Co-authored-by: Mikayla Toffler <[email protected]>
Co-authored-by: Dario Castañé <[email protected]>
What does this PR do?
Logs a warning about calling
tracer.StartwhenNoopTracer.StartSpanis invoked.Motivation
Users commonly forget to call
tracer.Startbefore generating spans with a contrib or the trace API. The tracer must be running in order to collect the spans, so this warning message should direct the user to the necessary steps and effectively prevent against this common customer escalation.Background
Until
tracer.Startis invoked, theglobaltracerobject is set toNoopTracer. It doesn't change totraceruntiltracer.Startis run. So any time theStartSpanmethod is invoked on theNoopTracer, we know thattracer.Starthas not yet been called.Reviewer's Checklist
Unsure? Have a question? Request a review!