We love pull requests. For new features, consider opening an issue to discuss the idea first. When you're ready to open a pull request, here's a quick guide.
-
Fork, clone and branch off
main
:git clone [email protected]:<your-username>/datadog-lambda-python.git git checkout -b <my-branch>
-
Make your changes. Ensure your code is compatible with Python 3.X.
-
Test your Lambda function against the locally modified version of Datadog Lambda library.
-
The easiest approach is to create a soft link of the
datadog_lambda
folder in your project's root. Note, this only overrides thedatadog_lambda
module, and you still need to install thedatadog_lambda
package or the Lambda layer to have the required dependencies.ln -s /PATH/TO/datadog-lambda-python/datadog_lambda /PATH/TO/MY/PROJECT
-
Another option is to install the
datadog_lambda
module from the local folder. E.g., add/PATH/TO/datadog-lambda-python/
to yourrequirements.txt
. This approach only work in a Linux environment, because the dependencyddtrace
utilizes the native C extension. -
You can also build and publish a Lambda layer to your own AWS account and use it for testing.
# Build layers using docker ./scripts/build_layers.sh # Publish the a testing layer to your own AWS account, and the ARN will be returned # Example: VERSION=1 REGIONS=us-east-1 LAYERS=Datadog-Python313 ./scripts/publish_layers.sh VERSION=<VERSION> REGIONS=<REGION> LAYERS=<LAYER> ./scripts/publish_layers.sh
-
-
Ensure the unit tests pass (install Docker if you haven't):
./scripts/run_tests.sh
-
Run the integration tests against your own AWS account and Datadog org (or ask a Datadog member to run):
BUILD_LAYERS=true DD_API_KEY=<your Datadog api key> ./scripts/run_integration_tests.sh
-
Update integration test snapshots if needed:
UPDATE_SNAPSHOTS=true DD_API_KEY=<your Datadog api key> ./scripts/run_integration_tests.sh
-
Push to your fork and submit a pull request.
At this point you're waiting on us. We may suggest some changes or improvements or alternatives.