APMSVLS-212 Reducing Python Lambda Layer Size by rithikanarayan · Pull Request #667 · DataDog/datadog-lambda-python

What does this PR do?

Applies strip --strip-unneeded to all .so files included in the Python lambda layer.

Motivation

Frequent increases in Python lambda layer size, exceeding checks.
Stripping binaries further (originally only applied strip --strip-debug) can reduce the unzipped layer size by about 2.5MB.

Testing Guidelines

Ran serverless e2e tests and manually inspected traces on a Python sample app. Manually checked that profiling and appsec still produced appropriate output. Used layer arn:aws:lambda:us-west-2:425362996713:layer:Python312-strip-unneeded-rithika:1 on an ARM Python 3.12 lambda function.

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)