Skip to content

Commit 01bddf0

Browse files
committed
Use config.cold_start_tracing.
1 parent 6b42cc4 commit 01bddf0

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

datadog_lambda/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Config:
4949
service = _get_env("DD_SERVICE")
5050
env = _get_env("DD_ENV")
5151

52-
cold_start_tracing = _get_env("DD_COLD_START_TRACING", "true", as_bool)
52+
cold_start_tracing = _get_env("DD_COLD_START_TRACING", "true", as_bool, depends_on_tracing=True)
5353
min_cold_start_trace_duration = _get_env("DD_MIN_COLD_START_DURATION", 3, int)
5454
cold_start_trace_skip_lib = _get_env(
5555
"DD_COLD_START_TRACE_SKIP_LIB", "ddtrace.internal.compat,ddtrace.filters",

datadog_lambda/wrapper.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,11 @@ def __init__(self, func):
121121
self.trace_extractor = None
122122
self.span = None
123123
self.inferred_span = None
124-
depends_on_dd_tracing_enabled = (
125-
lambda original_boolean: config.trace_enabled and original_boolean
126-
)
127-
self.cold_start_tracing = depends_on_dd_tracing_enabled(
128-
os.environ.get(DD_COLD_START_TRACING, "true").lower() == "true"
129-
)
130124
self.response = None
125+
131126
if config.profiling_enabled:
132127
self.prof = profiler.Profiler(env=config.env, service=config.service)
128+
133129
if config.trace_extractor:
134130
extractor_parts = config.trace_extractor.rsplit(".", 1)
135131
if len(extractor_parts) == 2:
@@ -277,7 +273,7 @@ def _after(self, event, context):
277273
create_dd_dummy_metadata_subsegment(
278274
self.trigger_tags, XraySubsegment.LAMBDA_FUNCTION_TAGS_KEY
279275
)
280-
should_trace_cold_start = self.cold_start_tracing and is_new_sandbox()
276+
should_trace_cold_start = config.cold_start_tracing and is_new_sandbox()
281277
if should_trace_cold_start:
282278
trace_ctx = tracer.current_trace_context()
283279

0 commit comments

Comments
 (0)