Skip to content

Add Cloud Tracing payload request/response support #562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ To further configure your plugin, use the following custom parameters in your `s
| `enableDDLogs` | Enable Datadog log collection using the Lambda Extension. Defaults to `true`. Note: This setting has no effect on logs sent by the Datadog Forwarder. |
| `monitors` | When defined, the Datadog plugin configures monitors for the deployed function. Requires setting `DATADOG_API_KEY` and `DATADOG_APP_KEY` in your environment. To learn how to define monitors, see [To Enable and Configure a Recommended Serverless Monitor](#to-enable-and-configure-a-recommended-serverless-monitor). |
| `captureLambdaPayload` | [Captures incoming and outgoing AWS Lambda payloads][17] in the Datadog APM spans for Lambda invocations. Defaults to `false`. |
| `captureCloudRequestPayload` | When using an AWS SDK client within your lambda function, [captures request data exchanged between it and AWS services][20] in the Datadog APM spans. Values: `all`. To [protect sensitive data][21], use JSON Path syntax. Defaults to `""`. |
| `captureCloudResponsePayload` | When using an AWS SDK client within your lambda function, [captures response data exchanged between it and AWS services][20] in the Datadog APM spans. Values: `all`. To [protect sensitive data][21], use JSON Path syntax. Defaults to `""`. |
| `enableSourceCodeIntegration` | Enable [Datadog Source Code Integration][18] for the function. Defaults to `true`. |
| `uploadGitMetadata` | Enable Git metadata uploading for the function, as a part of source code integration. Set this to false if you have the Datadog Github Integration installed, as it renders Git metadata uploading unnecessary. Defaults to `true`. |
| `subscribeToAccessLogs` | Enable automatic subscription of the Datadog Forwarder to API Gateway access log groups. Requires setting `forwarderArn`. Defaults to `true`. |
Expand All @@ -66,6 +68,7 @@ To further configure your plugin, use the following custom parameters in your `s
| `enableStepFunctionsTracing` | Enable automatic subscription of the Datadog Forwarder to Step Function log groups and Step Functions tracing. If no Step Function log groups are configured, then they are automatically created. Requires setting `forwarderArn`. Defaults to `false`. |
| `propagateUpstreamTrace` | When set to `true`, downstream Stepfunction invocation traces merge with upstream Stepfunction invocations. Defaults to `false`. |
| `redirectHandlers` | Optionally disable handler redirection if set to `false`. This should only be set to `false` when APM is fully disabled. Defaults to `true`. |

To use any of these parameters, add a `custom` > `datadog` section to your `serverless.yml` similar to this example:

```yaml
Expand Down Expand Up @@ -263,3 +266,5 @@ This product includes software developed at Datadog (<https://www.datadoghq.com/
[17]: https://www.datadoghq.com/blog/troubleshoot-lambda-function-request-response-payloads/
[18]: https://docs.datadoghq.com/integrations/guide/source-code-integration
[19]: https://docs.datadoghq.com/security/application_security/
[20]: https://docs.datadoghq.com/tracing/guide/aws_payload_tagging/
[21]: https://docs.datadoghq.com/tracing/guide/aws_payload_tagging/#protect-sensitive-information
24 changes: 24 additions & 0 deletions integration_tests/correct_extension_apigateway_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev",
"DD_LAMBDA_HANDLER": "py_handler.hello"
Expand Down Expand Up @@ -312,6 +314,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev",
"DD_LAMBDA_HANDLER": "py_handler.hello"
Expand Down Expand Up @@ -362,6 +366,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev",
"DD_LAMBDA_HANDLER": "py_handler.hello"
Expand Down Expand Up @@ -412,6 +418,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev",
"DD_LAMBDA_HANDLER": "js_handler.hello"
Expand Down Expand Up @@ -462,6 +470,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev",
"DD_LAMBDA_HANDLER": "js_handler.hello"
Expand Down Expand Up @@ -512,6 +522,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev",
"DD_LAMBDA_HANDLER": "js_handler.hello"
Expand Down Expand Up @@ -562,6 +574,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev"
Expand Down Expand Up @@ -612,6 +626,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev"
Expand Down Expand Up @@ -662,6 +678,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev"
Expand Down Expand Up @@ -712,6 +730,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev"
Expand Down Expand Up @@ -762,6 +782,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev"
}
Expand Down Expand Up @@ -810,6 +832,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev"
}
Expand Down
28 changes: 28 additions & 0 deletions integration_tests/correct_extension_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev",
"DD_LAMBDA_HANDLER": "py_handler.hello"
Expand Down Expand Up @@ -349,6 +351,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev",
"DD_LAMBDA_HANDLER": "py_handler.hello"
Expand Down Expand Up @@ -401,6 +405,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev",
"DD_LAMBDA_HANDLER": "py_handler.hello"
Expand Down Expand Up @@ -453,6 +459,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev",
"DD_LAMBDA_HANDLER": "js_handler.hello"
Expand Down Expand Up @@ -505,6 +513,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev",
"DD_LAMBDA_HANDLER": "js_handler.hello"
Expand Down Expand Up @@ -557,6 +567,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev",
"DD_LAMBDA_HANDLER": "js_handler.hello"
Expand Down Expand Up @@ -642,6 +654,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev"
Expand Down Expand Up @@ -697,6 +711,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev"
Expand Down Expand Up @@ -749,6 +765,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev"
Expand Down Expand Up @@ -804,6 +822,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev"
Expand Down Expand Up @@ -856,6 +876,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev"
Expand Down Expand Up @@ -908,6 +930,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/datadog_wrapper",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev"
Expand Down Expand Up @@ -960,6 +984,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev"
}
Expand Down Expand Up @@ -1010,6 +1036,8 @@
"DD_LOGS_INJECTION": false,
"DD_SERVERLESS_LOGS_ENABLED": true,
"DD_CAPTURE_LAMBDA_PAYLOAD": false,
"DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "",
"DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "",
"DD_SERVICE": "dd-sls-plugin-integration-test",
"DD_ENV": "dev"
}
Expand Down
Loading
Loading