feat(appsec): enable telemetry when appsec is enabled through the tracer and not the extension #641
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR does the two following things:
Enable instrumentation telemetry when DD_APPSEC_ENABLED=true, the same way the extension wrapper script does when DD_SERVERLESS_APPSEC_ENABLED:
https://github.com/DataDog/datadog-lambda-extension/blob/main/scripts/datadog_wrapper#L38
Prevent pruning of
*.dist-info/METADATA
files in the layer. These files are required for Appsec Software Composition Analysis to extract the Name and Version of dependencies:https://github.com/DataDog/dd-trace-py/blob/main/ddtrace/internal/packages.py#L25-L43
Motivation
In the continuity of moving from the extension implementation of appsec for python to the tracer, having functional runtime Software Composition Analysis is part of the scope.
Testing Guidelines
Manual testing for now, and system-tests will be coming soon.
Because the feature is entirely implemented on the
dd-trace-py
side, I don't think it makes a lot of sense to add unit tests here.Additional Notes
I reused the env variable instead of relying on the
config
module. Importing the config module resulted in cyclic imports that caused a lot of tests to fail for reasons I don't fully understand. I have not investigated further.Types of Changes
Check all that apply