Skip to content

Commit 6afabe5

Browse files
authored
chore(otel/span): reduce noise in start span benchmarks (#5652)
1 parent 88ca1b7 commit 6afabe5

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

benchmarks/otel_span/scenario.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
otel_tracer = get_tracer(__name__)
1515

1616

17-
utils.drop_traces(tracer)
18-
19-
2017
class OtelSpan(bm.Scenario):
2118
nspans = bm.var(type=int)
2219
ntags = bm.var(type=int)
@@ -34,7 +31,11 @@ def run(self):
3431
setmetrics = len(metrics) > 0
3532

3633
# run scenario to include finishing spans
34+
# Note - if finishspan is False the span will be gc'd when the SpanAggregrator._traces is reset
35+
# (ex: tracer.configure(filter) is called)
3736
finishspan = self.finishspan
37+
# Recreate span processors and configure global tracer to avoid sending traces to the agent
38+
utils.drop_traces(tracer)
3839

3940
def _(loops):
4041
for _ in range(loops):

benchmarks/span/scenario.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
from ddtrace import tracer
66

77

8-
utils.drop_traces(tracer)
9-
10-
118
class Span(bm.Scenario):
129
nspans = bm.var(type=int)
1310
ntags = bm.var(type=int)
@@ -26,8 +23,12 @@ def run(self):
2623
setmetrics = len(metrics) > 0
2724

2825
# run scenario to include finishing spans
26+
# Note - if finishspan is False the span will be gc'd when the SpanAggregrator._traces is reset
27+
# (ex: tracer.configure(filter) is called)
2928
finishspan = self.finishspan
3029
config._128_bit_trace_id_enabled = self.traceid128
30+
# Recreate span processors and configure global tracer to avoid sending traces to the agent
31+
utils.drop_traces(tracer)
3132

3233
def _(loops):
3334
for _ in range(loops):

0 commit comments

Comments
 (0)