Skip to content

Commit beadbcc

Browse files
authored
chore(benchmarks): combine ddtrace-run and startup benchmarks (#13391)
ddtrace-run benchmarks are broken, this PR removes this benchmarking scenario and combines it with the new `startup` scenario. Issues with ddtrace-run benchmarks: - telemetry variants do not enable/disable the generation of telemetry events. To record a telemetry event on application start up `_DD_INSTRUMENTATION_TELEMETRY_TESTS_FORCE_APP_STARTED` must be set to true. Otherwise telemetry events will be recorded 10 seconds after ddtrace instrumentation is applied - http proxy does not mock tracer-agent connections. We set the trace api version to v0.4 but then mock requests to the v0.5 endpoint. This does not make sense. - ddtrace-run benchmarks do not mock statsd connections. So the baseline that attempts to disable all http/udp/unix connections is inaccurate ## Checklist - [ ] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [ ] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
1 parent 234c2e9 commit beadbcc

File tree

5 files changed

+37
-115
lines changed

5 files changed

+37
-115
lines changed

.gitlab/benchmarks/microbenchmarks.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ microbenchmarks:
163163
- "packages_update_imported_dependencies"
164164
- "telemetry_add_metric"
165165
- "startup"
166-
- "ddtrace_run"
167166

168167
"microbenchmarks flaky":
169168
extends: .benchmarks

benchmarks/ddtrace_run/config.yaml

Lines changed: 0 additions & 46 deletions
This file was deleted.

benchmarks/ddtrace_run/scenario.py

Lines changed: 0 additions & 68 deletions
This file was deleted.

benchmarks/startup/config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
baseline: &defaults
22
env: {}
3+
ddtrace_run: false
4+
send_span: false
35
import_ddtrace: false
46
import_ddtrace_auto: false
57
import_flask: false
@@ -32,3 +34,29 @@ import_ddtrace_auto_django:
3234
<<: *defaults
3335
import_ddtrace_auto: true
3436
import_django: true
37+
ddtrace_run:
38+
<<: *defaults
39+
ddtrace_run: true
40+
ddtrace_run_appsec:
41+
<<: *defaults
42+
env: {"DD_APPSEC_ENABLED": "true"}
43+
ddtrace_run: true
44+
ddtrace_run_profiling:
45+
<<: *defaults
46+
env: {"DD_PROFILING_ENABLED": "true"}
47+
ddtrace_run: true
48+
ddtrace_run_telemetry_enabled:
49+
<<: *defaults
50+
env: {"_DD_INSTRUMENTATION_TELEMETRY_TESTS_FORCE_APP_STARTED": "true"}
51+
ddtrace_run: true
52+
ddtrace_run_telemetry_disabled:
53+
<<: *defaults
54+
env: {"DD_INSTRUMENTATION_TELEMETRY_ENABLED": "false", "_DD_INSTRUMENTATION_TELEMETRY_TESTS_FORCE_APP_STARTED": "false"}
55+
ddtrace_run: true
56+
ddtrace_run_send_span:
57+
<<: *defaults
58+
send_span: true
59+
ddtrace_run_runtime_metrics:
60+
<<: *defaults
61+
env: {"DD_RUNTIME_METRICS_ENABLED": "true"}
62+
ddtrace_run: true

benchmarks/startup/scenario.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
class Startup(bm.Scenario):
99
import_ddtrace: bool
1010
import_ddtrace_auto: bool
11+
ddtrace_run: bool
1112
import_flask: bool
1213
import_django: bool
14+
send_span: bool
1315
env: str
1416

1517
def run(self):
@@ -33,8 +35,15 @@ def run(self):
3335
# `import django` doesn't really do anything, `django.core.management` is what `manage.py` uses
3436
commands.append("import django.core.management")
3537

38+
if self.send_span:
39+
commands.append("from ddtrace.trace import tracer")
40+
commands.append("tracer.trace('test-x', service='bench-test').finish()")
41+
3642
args = ["python", "-c"] + [";".join(commands)]
3743

44+
if self.ddtrace_run:
45+
args = ["ddtrace-run"] + args
46+
3847
def _(loops: int):
3948
for _ in range(loops):
4049
subprocess.check_call(args=args, env=env)

0 commit comments

Comments
 (0)