Skip to content

Commit 1a1d453

Browse files
authored
Merge branch 'main' into emmett.butler/serverless-wheels
2 parents 3e255d8 + f313c46 commit 1a1d453

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

Dockerfile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,18 @@ RUN rm -rf \
6262
# https://docs.python.org/3.11/using/cmdline.html#cmdoption-O
6363
# https://docs.python.org/3/using/cmdline.html#envvar-PYTHONNODEBUGRANGES
6464
RUN PYTHONNODEBUGRANGES=1 python -OO -m compileall -b ./python/lib/$runtime/site-packages
65-
# remove all .py files except ddtrace/contrib/*/patch.py which are necessary
66-
# for ddtrace.patch to discover instrumationation packages.
67-
RUN find ./python/lib/$runtime/site-packages -name \*.py | grep -v ddtrace/contrib | xargs rm -rf
68-
RUN find ./python/lib/$runtime/site-packages/ddtrace/contrib -name \*.py | grep -v patch.py | xargs rm -rf
65+
# remove all .py files
66+
# DEV: ddtrace>=4.7.0rc3 checks for .pyc files in addition to .py files for instrumentation
67+
# discovery (DataDog/dd-trace-py#17196), so we can safely remove all .py files.
68+
# For older versions, we need to keep patch.py files for instrumentation discovery.
69+
RUN pip install --quiet packaging && \
70+
DDTRACE_VERSION=$(grep "^Version:" ./python/lib/$runtime/site-packages/ddtrace-*.dist-info/METADATA | awk '{print $2}') && \
71+
if python -c "from packaging.version import Version; exit(0 if Version('$DDTRACE_VERSION') >= Version('4.7.0rc3') else 1)"; then \
72+
find ./python/lib/$runtime/site-packages -name \*.py | xargs rm -rf; \
73+
else \
74+
find ./python/lib/$runtime/site-packages -name \*.py | grep -v ddtrace/contrib | xargs rm -rf && \
75+
find ./python/lib/$runtime/site-packages/ddtrace/contrib -name \*.py | grep -v patch.py | xargs rm -rf; \
76+
fi
6977
RUN find ./python/lib/$runtime/site-packages -name __pycache__ -type d -exec rm -r {} \+
7078

7179
# When building ddtrace from branch, remove extra source files. These are

datadog_lambda/durable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ def extract_durable_function_tags(event):
4444

4545
execution_name, execution_id = parsed
4646
return {
47-
"durable_function_execution_name": execution_name,
48-
"durable_function_execution_id": execution_id,
47+
"aws_lambda.durable_function.execution_name": execution_name,
48+
"aws_lambda.durable_function.execution_id": execution_id,
4949
}
5050

5151

tests/test_durable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def test_extracts_tags_from_event_with_durable_execution_arn(self):
5656
self.assertEqual(
5757
result,
5858
{
59-
"durable_function_execution_name": "my-execution",
60-
"durable_function_execution_id": "550e8400-e29b-41d4-a716-446655440004",
59+
"aws_lambda.durable_function.execution_name": "my-execution",
60+
"aws_lambda.durable_function.execution_id": "550e8400-e29b-41d4-a716-446655440004",
6161
},
6262
)
6363

0 commit comments

Comments
 (0)