From bd9502ca2046293fbd857931583217b0e9a4101b Mon Sep 17 00:00:00 2001
From: alexgallotta <5581237+alexgallotta@users.noreply.github.com>
Date: Tue, 13 May 2025 15:36:12 -0400
Subject: [PATCH 1/7] add serverless lwa doc
---
content/en/serverless/aws_lambda/lwa.md | 167 ++++++++++++++++++++++++
1 file changed, 167 insertions(+)
create mode 100644 content/en/serverless/aws_lambda/lwa.md
diff --git a/content/en/serverless/aws_lambda/lwa.md b/content/en/serverless/aws_lambda/lwa.md
new file mode 100644
index 0000000000000..29c839e5de15e
--- /dev/null
+++ b/content/en/serverless/aws_lambda/lwa.md
@@ -0,0 +1,167 @@
+---
+title: Lambda Web Adapter (Beta)
+---
+
+[Lambda Web Adapter](https://github.com/awslabs/aws-lambda-web-adapter) is a technology that allows you to run web applications on AWS Lambda. Datadog offers support for Lambda Web Adapter for NodeJs and Python runtimes, allowing you to monitor your web applications running on AWS Lambda.
+
+# How to integrate Datadog
+
+From the web application perspective, running in Lambda Web Adapter is similar to running in a web server. But the Datadog instrumentation have to be configured specifically for this setup, depending on whether the application is being deployed using a container or a zip file.
+In any case, the following steps are required:
+
+1. Adding the Lambda Web Adapter and Datadog extension
+2. Setting the required Datadog environment variables
+3. Ignore tracing for the readiness endpoint\*
+
+This last step is required only when using Datadog tracing
+
+## Container deployment
+
+1. Adding the Lambda Web Adapter and Datadog extension. Make sure to use 77 or later for Datadog and 0.9.1 or later for Lambda Web Adapter.
+
+```Dockerfile
+COPY --from=public.ecr.aws/datadog/lambda-extension:77 /opt/. /opt/
+COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1 /lambda-adapter /opt/extensions/lambda-adapter
+```
+
+2. Setting the required Datadog environment variables. Since there is no explicit shutdown system for Lambda, traces must be flushed as soon as possible so that their are not lost when the Lambda runtime environment is "frozen". Furthermore, the transparent tracing requires the Datadog extension to proxy requests before the Lambda Web Adapter, so the `AWS_LWA_LAMBDA_RUNTIME_API_PROXY` must be set to allow that. The port can be set with any available port
+
+```bash
+DD_TRACE_PARTIAL_FLUSH_MIN_SPANS=1
+DD_TRACE_PARTIAL_FLUSH_ENABLED=false
+
+AWS_LWA_LAMBDA_RUNTIME_API_PROXY=127.0.0.1:9002
+
+DD_API_KEY=$YOUR_API_KEY
+DD_SERVICE=$YOUR_SERVICE_NAME
+```
+
+3. Ignore tracing for the readiness endpoint. Since the Lambda Web Adapter is sending readiness check requests once it is loaded, the Datadog extension should not link them to the request that triggered the Lambda function. This can be done in different ways depending on the runtime. Assuming the readiness endpoint is the default (`GET` at `/`):
+
+{{< tabs >}}
+{{% tab "NodeJs" %}}
+
+```js
+const tracer = require('dd-trace').init();
+tracer.use('http', {
+ blocklist: ['/']
+});
+```
+
+Full working example at [TODO Github example](https://github.com/awslabs/aws-lambda-web-adapter/pull/602)
+{{% /tab %}}
+{{% tab "Python" %}}
+
+```python
+import ddtrace
+
+ddtrace.patch_all()
+from ddtrace.trace import tracer, TraceFilter
+...
+class IgnoreEndpointFilter(TraceFilter):
+ def __init__(self, pattern, method):
+ self.pattern = re.compile(pattern)
+ self.method = method
+
+ def process_trace(self, trace):
+ for span in trace:
+ url = span.get_tag("http.url")
+ if (
+ url is not None
+ and self.pattern.match(url)
+ and self.method == span.get_tag("http.method")
+ ):
+ return None
+ return trace
+
+
+tracer.configure(
+ trace_processors=[IgnoreEndpointFilter(r"http://127.0.0.1:8080/", "GET")]
+)
+
+```
+
+Full working example at [TODO Github example](https://github.com/awslabs/aws-lambda-web-adapter/pull/602)
+{{% /tab %}}
+{{< /tabs >}}
+
+## Zip deployment
+
+1. Adding the Lambda Web Adapter and Datadog extension. Make sure to use 77 or later for Datadog and 25 or later for Lambda Web Adapter.
+
+```
+arn:aws:lambda:${AWS::Region}:464622532012:layer:Datadog-Extension:77
+arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:25
+```
+
+for x86 and
+
+```
+arn:aws:lambda:${AWS::Region}:464622532012:layer:Datadog-Extension-ARM:78
+arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:25
+```
+
+for ARM
+
+2. Setting the required Datadog environment variables. Since there is no explicit shutdown system for Lambda, traces must be flushed as soon as possible so that their are not lost when the Lambda runtime environment is "frozen". Furthermore, the transparent tracing requires the Datadog extension to proxy requests before the Lambda Web Adapter, so the `AWS_LWA_LAMBDA_RUNTIME_API_PROXY` must be set to allow that. The port can be set with any available port
+
+```bash
+DD_TRACE_PARTIAL_FLUSH_MIN_SPANS=1
+DD_TRACE_PARTIAL_FLUSH_ENABLED=false
+
+AWS_LWA_LAMBDA_RUNTIME_API_PROXY=127.0.0.1:9002
+
+AWS_LAMBDA_EXEC_WRAPPER=/opt/bootstrap
+
+DD_API_KEY=$YOUR_API_KEY
+DD_SERVICE=$YOUR_SERVICE_NAME
+```
+
+3. Ignore tracing for the readiness endpoint. Since the Lambda Web Adapter is sending readiness check requests once it is loaded, the Datadog extension should not link them to the request that triggered the Lambda function. This can be done in different ways depending on the runtime. Assuming the readiness endpoint is the default (`GET` at `/`):
+
+{{< tabs >}}
+{{% tab "NodeJs" %}}
+
+```js
+const tracer = require('dd-trace').init();
+tracer.use('http', {
+ blocklist: ['/']
+});
+```
+
+Full working example at [TODO Github example](https://github.com/awslabs/aws-lambda-web-adapter/pull/602)
+{{% /tab %}}
+{{% tab "Python" %}}
+
+```python
+import ddtrace
+
+ddtrace.patch_all()
+from ddtrace.trace import tracer, TraceFilter
+...
+class IgnoreEndpointFilter(TraceFilter):
+ def __init__(self, pattern, method):
+ self.pattern = re.compile(pattern)
+ self.method = method
+
+ def process_trace(self, trace):
+ for span in trace:
+ url = span.get_tag("http.url")
+ if (
+ url is not None
+ and self.pattern.match(url)
+ and self.method == span.get_tag("http.method")
+ ):
+ return None
+ return trace
+
+
+tracer.configure(
+ trace_processors=[IgnoreEndpointFilter(r"http://127.0.0.1:8080/", "GET")]
+)
+
+```
+
+Full working example at [TODO Github example](https://github.com/awslabs/aws-lambda-web-adapter/pull/602)
+{{% /tab %}}
+{{< /tabs >}}
From 2e758b8551aa43289358bd2371b18931bb6b20e1 Mon Sep 17 00:00:00 2001
From: alexgallotta <5581237+alexgallotta@users.noreply.github.com>
Date: Wed, 14 May 2025 11:10:50 -0400
Subject: [PATCH 2/7] change beta to preview
---
content/en/serverless/aws_lambda/lwa.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/content/en/serverless/aws_lambda/lwa.md b/content/en/serverless/aws_lambda/lwa.md
index 29c839e5de15e..08d433ac71e16 100644
--- a/content/en/serverless/aws_lambda/lwa.md
+++ b/content/en/serverless/aws_lambda/lwa.md
@@ -1,5 +1,5 @@
---
-title: Lambda Web Adapter (Beta)
+title: Lambda Web Adapter (Preview)
---
[Lambda Web Adapter](https://github.com/awslabs/aws-lambda-web-adapter) is a technology that allows you to run web applications on AWS Lambda. Datadog offers support for Lambda Web Adapter for NodeJs and Python runtimes, allowing you to monitor your web applications running on AWS Lambda.
From ec2699ffb624f0d66c8bbad169d7e6ff97873901 Mon Sep 17 00:00:00 2001
From: alexgallotta <5581237+alexgallotta@users.noreply.github.com>
Date: Thu, 15 May 2025 11:46:21 -0400
Subject: [PATCH 3/7] fix grammar
---
content/en/serverless/aws_lambda/lwa.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/content/en/serverless/aws_lambda/lwa.md b/content/en/serverless/aws_lambda/lwa.md
index 08d433ac71e16..a4285350197e5 100644
--- a/content/en/serverless/aws_lambda/lwa.md
+++ b/content/en/serverless/aws_lambda/lwa.md
@@ -6,7 +6,7 @@ title: Lambda Web Adapter (Preview)
# How to integrate Datadog
-From the web application perspective, running in Lambda Web Adapter is similar to running in a web server. But the Datadog instrumentation have to be configured specifically for this setup, depending on whether the application is being deployed using a container or a zip file.
+From the web application perspective, running in Lambda Web Adapter is similar to running in a web server. But the Datadog instrumentation has to be configured specifically for this setup, depending on whether the application is being deployed using a container or a zip file.
In any case, the following steps are required:
1. Adding the Lambda Web Adapter and Datadog extension
@@ -24,7 +24,7 @@ COPY --from=public.ecr.aws/datadog/lambda-extension:77 /opt/. /opt/
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1 /lambda-adapter /opt/extensions/lambda-adapter
```
-2. Setting the required Datadog environment variables. Since there is no explicit shutdown system for Lambda, traces must be flushed as soon as possible so that their are not lost when the Lambda runtime environment is "frozen". Furthermore, the transparent tracing requires the Datadog extension to proxy requests before the Lambda Web Adapter, so the `AWS_LWA_LAMBDA_RUNTIME_API_PROXY` must be set to allow that. The port can be set with any available port
+2. Setting the required Datadog environment variables. Since there is no explicit shutdown system for Lambda, traces must be flushed as soon as possible so their are not lost when the Lambda runtime environment is "frozen". Furthermore, the transparent tracing requires the Datadog extension to proxy requests before the Lambda Web Adapter, so the `AWS_LWA_LAMBDA_RUNTIME_API_PROXY` must be set to allow that. The port can be set with any available port
```bash
DD_TRACE_PARTIAL_FLUSH_MIN_SPANS=1
From 815eb7b94624e1a0f2d8759240cb364822341115 Mon Sep 17 00:00:00 2001
From: alexgallotta <5581237+alexgallotta@users.noreply.github.com>
Date: Thu, 15 May 2025 11:47:26 -0400
Subject: [PATCH 4/7] grammar
---
content/en/serverless/aws_lambda/lwa.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/content/en/serverless/aws_lambda/lwa.md b/content/en/serverless/aws_lambda/lwa.md
index a4285350197e5..130a45f1f6e59 100644
--- a/content/en/serverless/aws_lambda/lwa.md
+++ b/content/en/serverless/aws_lambda/lwa.md
@@ -24,7 +24,7 @@ COPY --from=public.ecr.aws/datadog/lambda-extension:77 /opt/. /opt/
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1 /lambda-adapter /opt/extensions/lambda-adapter
```
-2. Setting the required Datadog environment variables. Since there is no explicit shutdown system for Lambda, traces must be flushed as soon as possible so their are not lost when the Lambda runtime environment is "frozen". Furthermore, the transparent tracing requires the Datadog extension to proxy requests before the Lambda Web Adapter, so the `AWS_LWA_LAMBDA_RUNTIME_API_PROXY` must be set to allow that. The port can be set with any available port
+2. Setting the required Datadog environment variables. Since there is no explicit shutdown system for Lambda, traces must be flushed as soon as possible so they are not lost when the Lambda runtime environment is "frozen". Furthermore, the transparent tracing requires the Datadog extension to proxy requests before the Lambda Web Adapter, so the `AWS_LWA_LAMBDA_RUNTIME_API_PROXY` must be set to allow that. The port can be set with any available port
```bash
DD_TRACE_PARTIAL_FLUSH_MIN_SPANS=1
From 6e02f24b32e8c0125ecb8c3486aeefa5a7479da7 Mon Sep 17 00:00:00 2001
From: alexgallotta <5581237+alexgallotta@users.noreply.github.com>
Date: Fri, 16 May 2025 11:45:12 -0400
Subject: [PATCH 5/7] add github links with examples
---
content/en/serverless/aws_lambda/lwa.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/content/en/serverless/aws_lambda/lwa.md b/content/en/serverless/aws_lambda/lwa.md
index 130a45f1f6e59..cb000ccfc0295 100644
--- a/content/en/serverless/aws_lambda/lwa.md
+++ b/content/en/serverless/aws_lambda/lwa.md
@@ -17,6 +17,8 @@ This last step is required only when using Datadog tracing
## Container deployment
+A full example is on [Github](https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog)
+
1. Adding the Lambda Web Adapter and Datadog extension. Make sure to use 77 or later for Datadog and 0.9.1 or later for Lambda Web Adapter.
```Dockerfile
@@ -48,7 +50,6 @@ tracer.use('http', {
});
```
-Full working example at [TODO Github example](https://github.com/awslabs/aws-lambda-web-adapter/pull/602)
{{% /tab %}}
{{% tab "Python" %}}
@@ -81,12 +82,13 @@ tracer.configure(
```
-Full working example at [TODO Github example](https://github.com/awslabs/aws-lambda-web-adapter/pull/602)
{{% /tab %}}
{{< /tabs >}}
## Zip deployment
+A full example is on [Github](https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog)
+
1. Adding the Lambda Web Adapter and Datadog extension. Make sure to use 77 or later for Datadog and 25 or later for Lambda Web Adapter.
```
@@ -129,7 +131,6 @@ tracer.use('http', {
});
```
-Full working example at [TODO Github example](https://github.com/awslabs/aws-lambda-web-adapter/pull/602)
{{% /tab %}}
{{% tab "Python" %}}
@@ -162,6 +163,5 @@ tracer.configure(
```
-Full working example at [TODO Github example](https://github.com/awslabs/aws-lambda-web-adapter/pull/602)
{{% /tab %}}
{{< /tabs >}}
From fd78fbae551a7e0c8892807dda6d49f5fafcd192 Mon Sep 17 00:00:00 2001
From: alexgallotta <5581237+alexgallotta@users.noreply.github.com>
Date: Fri, 16 May 2025 14:11:31 -0400
Subject: [PATCH 6/7] align version 77 everywhere
---
content/en/serverless/aws_lambda/lwa.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/content/en/serverless/aws_lambda/lwa.md b/content/en/serverless/aws_lambda/lwa.md
index cb000ccfc0295..ef56b6199ae43 100644
--- a/content/en/serverless/aws_lambda/lwa.md
+++ b/content/en/serverless/aws_lambda/lwa.md
@@ -99,7 +99,7 @@ arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:25
for x86 and
```
-arn:aws:lambda:${AWS::Region}:464622532012:layer:Datadog-Extension-ARM:78
+arn:aws:lambda:${AWS::Region}:464622532012:layer:Datadog-Extension-ARM:77
arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:25
```
From 20d223cc3b3488f2c82cdb86606e0a3f37d41cae Mon Sep 17 00:00:00 2001
From: Ida Adjivon <65119712+iadjivon@users.noreply.github.com>
Date: Fri, 16 May 2025 20:51:01 -0400
Subject: [PATCH 7/7] reformatted the documentation to fit Docs Formats, edited
content, added to the nav bar
---
config/_default/menus/main.en.yaml | 5 +
content/en/serverless/aws_lambda/lwa.md | 182 ++++++++++++++++--------
2 files changed, 125 insertions(+), 62 deletions(-)
diff --git a/config/_default/menus/main.en.yaml b/config/_default/menus/main.en.yaml
index d4e253c1a05ae..9a5c8143c319e 100644
--- a/config/_default/menus/main.en.yaml
+++ b/config/_default/menus/main.en.yaml
@@ -3162,6 +3162,11 @@ menu:
parent: serverless_aws_lambda
identifier: libraries_integrations
weight: 111
+ - name: Lambda Web Adapter
+ url: serverless/aws_lambda/lwa
+ parent: serverless_aws_lambda
+ identifier: serverless_aws_lambda_lwa
+ weight: 112
- name: AWS Step Functions
url: serverless/step_functions
parent: serverless
diff --git a/content/en/serverless/aws_lambda/lwa.md b/content/en/serverless/aws_lambda/lwa.md
index ef56b6199ae43..980d49e4865ee 100644
--- a/content/en/serverless/aws_lambda/lwa.md
+++ b/content/en/serverless/aws_lambda/lwa.md
@@ -1,32 +1,77 @@
---
-title: Lambda Web Adapter (Preview)
+title: Lambda Web Adapter
+further_reading:
+ - link: '/serverless/configuration/'
+ tag: 'Documentation'
+ text: 'Configure Serverless Monitoring'
+ - link: "/integrations/amazon_lambda/"
+ tag: "Documentation"
+ text: "AWS Lambda Integration"
---
-[Lambda Web Adapter](https://github.com/awslabs/aws-lambda-web-adapter) is a technology that allows you to run web applications on AWS Lambda. Datadog offers support for Lambda Web Adapter for NodeJs and Python runtimes, allowing you to monitor your web applications running on AWS Lambda.
+{{< callout url="#" btn_hidden="true" header="Join the Preview!" >}}
+Lambda Web Adapter is in Preview.
+{{< /callout >}}
-# How to integrate Datadog
+## Overview
-From the web application perspective, running in Lambda Web Adapter is similar to running in a web server. But the Datadog instrumentation has to be configured specifically for this setup, depending on whether the application is being deployed using a container or a zip file.
-In any case, the following steps are required:
+The AWS [Lambda Web Adapter][1] is a framework that allows developers to run web applications on AWS Lambda.
-1. Adding the Lambda Web Adapter and Datadog extension
-2. Setting the required Datadog environment variables
-3. Ignore tracing for the readiness endpoint\*
+Datadog supports Lambda Web Adapter for Node.js and Python runtimes, therefore providing you a solution to monitoring your web applications running on AWS Lambda.
-This last step is required only when using Datadog tracing
+## How to integrate Datadog
-## Container deployment
+The Lambda Web Adapter can run Lambda functions that are packaged as docker images or as Zip files. The following steps are required for instrumenting the Lambda Web Adapter with Datadog for both formats:
-A full example is on [Github](https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog)
+1. [Add the Lambda Web Adapter and Datadog extension](#1-add-the-lambda-web-adapter-and-datadog-extension)
+2. [Set the required Datadog environment variables](#2-set-the-required-datadog-environment-variables)
+3. [Ignore tracing for the readiness endpoint](#3-ignore-tracing-for-the-readiness-endpoint-required-only-when-using-datadog-tracing) (_*required only when using Datadog tracing_)
-1. Adding the Lambda Web Adapter and Datadog extension. Make sure to use 77 or later for Datadog and 0.9.1 or later for Lambda Web Adapter.
+#### 1. Add the Lambda Web Adapter and Datadog extension
+
+{{< tabs >}}
+{{% tab "Container deployment" %}}
+This configuration requires Datadog Lambda extension `v77+` and Lambda Web Adapter `v0.9.1+`. See a sample of the container deployment configuration on [Github][2].
```Dockerfile
COPY --from=public.ecr.aws/datadog/lambda-extension:77 /opt/. /opt/
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1 /lambda-adapter /opt/extensions/lambda-adapter
```
-2. Setting the required Datadog environment variables. Since there is no explicit shutdown system for Lambda, traces must be flushed as soon as possible so they are not lost when the Lambda runtime environment is "frozen". Furthermore, the transparent tracing requires the Datadog extension to proxy requests before the Lambda Web Adapter, so the `AWS_LWA_LAMBDA_RUNTIME_API_PROXY` must be set to allow that. The port can be set with any available port
+[1]: https://github.com/awslabs/aws-lambda-web-adapter
+[2]: https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog
+[3]: https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog
+{{% /tab %}}
+
+{{% tab "Zip deployment" %}}
+This requires Datadog Lambda extension `v77+` and `v25+` or later for Lambda Web Adapter. See a sample of the Zip deployment configuration on [Github][3].
+
+
+**for x86**
+
+```shell
+arn:aws:lambda:${AWS::Region}:464622532012:layer:Datadog-Extension:77
+arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:25
+```
+
+**for ARM**
+```shell
+arn:aws:lambda:${AWS::Region}:464622532012:layer:Datadog-Extension-ARM:77
+arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:25
+```
+[1]: https://github.com/awslabs/aws-lambda-web-adapter
+[2]: https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog
+[3]: https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog
+{{% /tab %}}
+{{< /tabs >}}
+
+#### 2. Set the required Datadog environment variables
+{{< tabs >}}
+{{% tab "Container deployment" %}}
+
+Since there is no explicit shutdown system for Lambda, traces must be flushed as soon as possible so they are not lost when the Lambda runtime environment is "frozen".
+
+The transparent tracing requires the Datadog extension to also proxy requests before the Lambda Web Adapter, so the `AWS_LWA_LAMBDA_RUNTIME_API_PROXY` must be set to allow that. The port can be set with any available port.
```bash
DD_TRACE_PARTIAL_FLUSH_MIN_SPANS=1
@@ -38,22 +83,55 @@ DD_API_KEY=$YOUR_API_KEY
DD_SERVICE=$YOUR_SERVICE_NAME
```
-3. Ignore tracing for the readiness endpoint. Since the Lambda Web Adapter is sending readiness check requests once it is loaded, the Datadog extension should not link them to the request that triggered the Lambda function. This can be done in different ways depending on the runtime. Assuming the readiness endpoint is the default (`GET` at `/`):
+[1]: https://github.com/awslabs/aws-lambda-web-adapter
+[2]: https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog
+[3]: https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog
+{{% /tab %}}
+
+{{% tab "Zip deployment" %}}
+Since there is no explicit shutdown system for Lambda, traces must be flushed as soon as possible so they are not lost when the Lambda runtime environment is "frozen".
+
+The transparent tracing requires the Datadog extension to also proxy requests before the Lambda Web Adapter, so the `AWS_LWA_LAMBDA_RUNTIME_API_PROXY` must be set to allow that. The port can be set with any available port.
+
+```bash
+DD_TRACE_PARTIAL_FLUSH_MIN_SPANS=1
+DD_TRACE_PARTIAL_FLUSH_ENABLED=false
+
+AWS_LWA_LAMBDA_RUNTIME_API_PROXY=127.0.0.1:9002
+
+AWS_LAMBDA_EXEC_WRAPPER=/opt/bootstrap
+
+DD_API_KEY=$YOUR_API_KEY
+DD_SERVICE=$YOUR_SERVICE_NAME
+```
+[1]: https://github.com/awslabs/aws-lambda-web-adapter
+[2]: https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog
+[3]: https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog
+ {{% /tab %}}
+{{< /tabs >}}
+
+#### 3. Ignore tracing for the readiness endpoint
+\*_This step is required only when using Datadog tracing_.
{{< tabs >}}
-{{% tab "NodeJs" %}}
+{{% tab "Container deployment" %}}
+
+Since the Lambda Web Adapter sends readiness check requests once it is loaded, the Datadog extension must not link them to the request that triggered the Lambda function.
+
+The configuration differs depending on the runtime. Assuming the readiness endpoint is the default (`GET` at `/`):
+
+**NodeJs**
```js
const tracer = require('dd-trace').init();
tracer.use('http', {
blocklist: ['/']
});
-```
+ ```
-{{% /tab %}}
-{{% tab "Python" %}}
+**Python**
-```python
+```python
import ddtrace
ddtrace.patch_all()
@@ -79,50 +157,19 @@ class IgnoreEndpointFilter(TraceFilter):
tracer.configure(
trace_processors=[IgnoreEndpointFilter(r"http://127.0.0.1:8080/", "GET")]
)
-
-```
-
-{{% /tab %}}
-{{< /tabs >}}
-
-## Zip deployment
-
-A full example is on [Github](https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog)
-
-1. Adding the Lambda Web Adapter and Datadog extension. Make sure to use 77 or later for Datadog and 25 or later for Lambda Web Adapter.
-
```
-arn:aws:lambda:${AWS::Region}:464622532012:layer:Datadog-Extension:77
-arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:25
-```
-
-for x86 and
-
-```
-arn:aws:lambda:${AWS::Region}:464622532012:layer:Datadog-Extension-ARM:77
-arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerArm64:25
-```
-
-for ARM
+[1]: https://github.com/awslabs/aws-lambda-web-adapter
+[2]: https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog
+[3]: https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog
+ {{% /tab %}}
-2. Setting the required Datadog environment variables. Since there is no explicit shutdown system for Lambda, traces must be flushed as soon as possible so that their are not lost when the Lambda runtime environment is "frozen". Furthermore, the transparent tracing requires the Datadog extension to proxy requests before the Lambda Web Adapter, so the `AWS_LWA_LAMBDA_RUNTIME_API_PROXY` must be set to allow that. The port can be set with any available port
+{{% tab "Zip deployment" %}}
-```bash
-DD_TRACE_PARTIAL_FLUSH_MIN_SPANS=1
-DD_TRACE_PARTIAL_FLUSH_ENABLED=false
-
-AWS_LWA_LAMBDA_RUNTIME_API_PROXY=127.0.0.1:9002
-
-AWS_LAMBDA_EXEC_WRAPPER=/opt/bootstrap
-
-DD_API_KEY=$YOUR_API_KEY
-DD_SERVICE=$YOUR_SERVICE_NAME
-```
+Since the Lambda Web Adapter sends readiness check requests once it is loaded, the Datadog extension must not link them to the request that triggered the Lambda function.
-3. Ignore tracing for the readiness endpoint. Since the Lambda Web Adapter is sending readiness check requests once it is loaded, the Datadog extension should not link them to the request that triggered the Lambda function. This can be done in different ways depending on the runtime. Assuming the readiness endpoint is the default (`GET` at `/`):
+The configuration differs depending on the runtime. Assuming the readiness endpoint is the default (`GET` at `/`):
-{{< tabs >}}
-{{% tab "NodeJs" %}}
+**NodeJs**
```js
const tracer = require('dd-trace').init();
@@ -131,8 +178,7 @@ tracer.use('http', {
});
```
-{{% /tab %}}
-{{% tab "Python" %}}
+**Python**
```python
import ddtrace
@@ -162,6 +208,18 @@ tracer.configure(
)
```
-
-{{% /tab %}}
+[1]: https://github.com/awslabs/aws-lambda-web-adapter
+[2]: https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog
+[3]: https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog
+ {{% /tab %}}
{{< /tabs >}}
+
+
+
+## Further Reading
+
+{{< partial name="whats-next/whats-next.html" >}}
+
+[1]: https://github.com/awslabs/aws-lambda-web-adapter
+[2]: https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog
+[3]: https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/datadog
\ No newline at end of file