Skip to content

Commit e9d9fc7

Browse files
committed
update telemetry collection benchmarks
1 parent 8a2456a commit e9d9fc7

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

benchmarks/ddtrace_run/scenario.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ def run(self):
2020
env["DD_RUNTIME_METRICS_ENABLED"] = str(self.runtimemetrics)
2121
env["DD_APPSEC_ENABLED"] = str(self.appsec)
2222

23+
if self.telemetry:
24+
# Force app started event, this is needed for telemetry to be enabled
25+
# immediately after the process starts to avoid the 10 second delay.
26+
env["_DD_INSTRUMENTATION_TELEMETRY_TESTS_FORCE_APP_STARTED"] = "true"
27+
2328
# initialize subprocess args
2429
subp_cmd = []
2530
code = "import ddtrace; ddtrace._monkey._patch_all()\n"
@@ -29,7 +34,7 @@ def run(self):
2934

3035
if self.http:
3136
# mock requests to the trace agent before starting services
32-
env["DD_TRACE_API_VERSION"] = "v0.4"
37+
env["DD_TRACE_API_VERSION"] = "v0.5"
3338
code += """
3439
import httpretty
3540
from ddtrace.trace import tracer
@@ -41,10 +46,6 @@ def run(self):
4146
# profiler will collect snapshot during shutdown
4247
httpretty.register_uri(httpretty.POST, '%s/%s' % (tracer.agent_trace_url, 'profiling/v1/input'))
4348
"""
44-
45-
if self.telemetry:
46-
code += "telemetry_writer.enable()\n"
47-
4849
if self.tracing:
4950
code += "span = tracer.trace('test-x', service='bench-test'); span.finish()\n"
5051

benchmarks/startup/config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ baseline: &defaults
44
import_ddtrace_auto: false
55
import_flask: false
66
import_django: false
7+
send_span: false
78
baseline_flask:
89
<<: *defaults
910
import_flask: true
@@ -32,3 +33,13 @@ import_ddtrace_auto_django:
3233
<<: *defaults
3334
import_ddtrace_auto: true
3435
import_django: true
36+
import_ddtrace_auto_start_telemetry:
37+
<<: *defaults
38+
# By default telemetry collection is enabled after 10 seconds we need to force it to start immediately
39+
# to detect the overhead.
40+
env: {"_DD_INSTRUMENTATION_TELEMETRY_TESTS_FORCE_APP_STARTED": "true"}
41+
import_ddtrace_auto: true
42+
import_ddtrace_auto_send_span:
43+
<<: *defaults
44+
import_ddtrace_auto: true
45+
send_span: true

benchmarks/startup/scenario.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class Startup(bm.Scenario):
1010
import_ddtrace_auto: bool
1111
import_flask: bool
1212
import_django: bool
13+
send_span: bool
1314
env: str
1415

1516
def run(self):
@@ -32,7 +33,9 @@ def run(self):
3233
if self.import_django:
3334
# `import django` doesn't really do anything, `django.core.management` is what `manage.py` uses
3435
commands.append("import django.core.management")
35-
36+
if self.send_span:
37+
commands.append("from ddtrace.trace import tracer")
38+
commands.append("tracer.trace('test').finish()")
3639
args = ["python", "-c"] + [";".join(commands)]
3740

3841
def _(loops: int):

0 commit comments

Comments
 (0)