Skip to content

Commit 831f368

Browse files
committed
Use config.cold_start_tracing.
1 parent 9a23c2a commit 831f368

2 files changed

Lines changed: 4 additions & 2 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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,10 @@ def __init__(self, func):
145145
except Exception:
146146
logger.debug(f"Malformatted for env {DD_COLD_START_TRACE_SKIP_LIB}")
147147
self.response = None
148+
148149
if config.profiling_enabled:
149150
self.prof = profiler.Profiler(env=config.env, service=config.service)
151+
150152
if config.trace_extractor:
151153
extractor_parts = config.trace_extractor.rsplit(".", 1)
152154
if len(extractor_parts) == 2:
@@ -296,7 +298,7 @@ def _after(self, event, context):
296298
create_dd_dummy_metadata_subsegment(
297299
self.trigger_tags, XraySubsegment.LAMBDA_FUNCTION_TAGS_KEY
298300
)
299-
should_trace_cold_start = self.cold_start_tracing and is_new_sandbox()
301+
should_trace_cold_start = config.cold_start_tracing and is_new_sandbox()
300302
if should_trace_cold_start:
301303
trace_ctx = tracer.current_trace_context()
302304

0 commit comments

Comments
 (0)