Skip to content

Commit d43beed

Browse files
authored
chore(6to7): add microbenchmarks (#5535)
Benchmark creating and finishing spans with 128bit trace ids. Output: ``` ..................... span-start: Mean +- std dev: 944 us +- 20 us ..................... span-start-traceid128: Mean +- std dev: 1.14 ms +- 0.02 ms ..................... span-add-tags: Mean +- std dev: 52.1 ms +- 0.6 ms ..................... span-add-metrics: Mean +- std dev: 29.4 ms +- 0.5 ms ..................... span-start-finish: Mean +- std dev: 1.19 ms +- 0.02 ms ..................... span-start-finish-traceid128: Mean +- std dev: 1.40 ms +- 0.02 ms ``` ## Checklist - [x] Change(s) are motivated and described in the PR description. - [x] Testing strategy is described if automated tests are not included in the PR. - [x] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/contributing.html#Release-Note-Guidelines) are followed. - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [x] PR description includes explicit acknowledgement/acceptance of the performance implications of this PR as reported in the benchmarks PR comment. ## Reviewer Checklist - [x] Title is accurate. - [x] No unnecessary changes are introduced. - [x] Description motivates each change. - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [x] Testing strategy adequately addresses listed risk(s). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] Release note makes sense to a user of the library. - [x] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment.
1 parent 209f452 commit d43beed

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

benchmarks/span/config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ start: &base
44
ltags: 0
55
nmetrics: 0
66
finishspan: false
7+
traceid128: false
8+
start-traceid128:
9+
<<: *base
10+
traceid128: true
711
add-tags:
812
<<: *base
913
ntags: 100
@@ -14,3 +18,7 @@ add-metrics:
1418
start-finish:
1519
<<: *base
1620
finishspan: true
21+
start-finish-traceid128:
22+
<<: *base
23+
finishspan: true
24+
traceid128: true

benchmarks/span/scenario.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import bm
22
import bm.utils as utils
33

4+
from ddtrace import config
5+
46

57
class Span(bm.Scenario):
68
nspans = bm.var(type=int)
79
ntags = bm.var(type=int)
810
ltags = bm.var(type=int)
911
nmetrics = bm.var(type=int)
1012
finishspan = bm.var_bool()
13+
traceid128 = bm.var_bool()
1114

1215
def run(self):
1316
# run scenario to also set tags on spans
@@ -20,6 +23,7 @@ def run(self):
2023

2124
# run scenario to include finishing spans
2225
finishspan = self.finishspan
26+
config._128_bit_trace_id_enabled = self.traceid128
2327

2428
def _(loops):
2529
for _ in range(loops):

0 commit comments

Comments
 (0)