File tree Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,11 @@ def run(self):
20
20
env ["DD_RUNTIME_METRICS_ENABLED" ] = str (self .runtimemetrics )
21
21
env ["DD_APPSEC_ENABLED" ] = str (self .appsec )
22
22
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
+
23
28
# initialize subprocess args
24
29
subp_cmd = []
25
30
code = "import ddtrace; ddtrace._monkey._patch_all()\n "
@@ -29,7 +34,7 @@ def run(self):
29
34
30
35
if self .http :
31
36
# 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 "
33
38
code += """
34
39
import httpretty
35
40
from ddtrace.trace import tracer
@@ -41,10 +46,6 @@ def run(self):
41
46
# profiler will collect snapshot during shutdown
42
47
httpretty.register_uri(httpretty.POST, '%s/%s' % (tracer.agent_trace_url, 'profiling/v1/input'))
43
48
"""
44
-
45
- if self .telemetry :
46
- code += "telemetry_writer.enable()\n "
47
-
48
49
if self .tracing :
49
50
code += "span = tracer.trace('test-x', service='bench-test'); span.finish()\n "
50
51
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ baseline: &defaults
4
4
import_ddtrace_auto : false
5
5
import_flask : false
6
6
import_django : false
7
+ send_span : false
7
8
baseline_flask :
8
9
<< : *defaults
9
10
import_flask : true
@@ -32,3 +33,13 @@ import_ddtrace_auto_django:
32
33
<< : *defaults
33
34
import_ddtrace_auto : true
34
35
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
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ class Startup(bm.Scenario):
10
10
import_ddtrace_auto : bool
11
11
import_flask : bool
12
12
import_django : bool
13
+ send_span : bool
13
14
env : str
14
15
15
16
def run (self ):
@@ -32,7 +33,9 @@ def run(self):
32
33
if self .import_django :
33
34
# `import django` doesn't really do anything, `django.core.management` is what `manage.py` uses
34
35
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()" )
36
39
args = ["python" , "-c" ] + [";" .join (commands )]
37
40
38
41
def _ (loops : int ):
You can’t perform that action at this time.
0 commit comments