File tree Expand file tree Collapse file tree 3 files changed +16
-8
lines changed
Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Original file line number Diff line number Diff 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
6464RUN 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
6977RUN 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments