File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff 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 += """
3439import httpretty
3540from ddtrace.trace import tracer
@@ -41,10 +46,6 @@ def run(self):
4146# profiler will collect snapshot during shutdown
4247httpretty.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
Original file line number Diff line number Diff line change @@ -32,3 +32,9 @@ import_ddtrace_auto_django:
3232 << : *defaults
3333 import_ddtrace_auto : true
3434 import_django : true
35+ import_ddtrace_auto_start_telemetry :
36+ << : *defaults
37+ # By default telemetry collection is enabled after 10 seconds we need to force it to start immediately
38+ # to detect the overhead.
39+ env : {"_DD_INSTRUMENTATION_TELEMETRY_TESTS_FORCE_APP_STARTED": "true"}
40+ import_ddtrace_auto : true
You can’t perform that action at this time.
0 commit comments