Skip to content

Commit e3fa2ee

Browse files
authored
redo - AWS Lambda install pages (#31085)
* recreating * ext
1 parent 2ea95ad commit e3fa2ee

File tree

12 files changed

+214
-284
lines changed

12 files changed

+214
-284
lines changed

config/_default/menus/main.en.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3209,8 +3209,8 @@ menu:
32093209
parent: serverless
32103210
identifier: serverless_aws_lambda
32113211
weight: 1
3212-
- name: Installation
3213-
url: serverless/aws_lambda/installation
3212+
- name: Instrumentation
3213+
url: serverless/aws_lambda/instrumentation
32143214
parent: serverless_aws_lambda
32153215
identifier: serverless_aws_lambda_installation
32163216
weight: 101

content/en/serverless/aws_lambda/configuration.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ First, [install][1] Datadog Serverless Monitoring to begin collecting metrics, t
4141
- [Migrating between x86 to arm64 with the Datadog Lambda Extension](#migrating-between-x86-to-arm64-with-the-datadog-lambda-extension)
4242
- [Configure the Datadog Lambda extension for local testing](#configure-the-datadog-lambda-extension-for-local-testing)
4343
- [Instrument AWS Lambda with the OpenTelemetry API](#instrument-aws-lambda-with-the-opentelemetry-api)
44+
- [Using Datadog Lambda Extension v67+](#using-datadog-lambda-extension-v67)
45+
- [Configure Auto-linking for DynamoDB PutItem](#configure-auto-linking-for-dynamodb-putitem)
4446
- [Visualize and model AWS services correctly](#visualize-and-model-aws-services-by-resource-name)
4547
- [Troubleshoot](#troubleshoot)
4648
- [Further Reading](#further-reading)
@@ -274,6 +276,8 @@ DD_APM_REPLACE_TAGS=[
274276
]
275277
```
276278

279+
To collect payloads from AWS services, see [Capture Requests and Responses from AWS Services][54].
280+
277281

278282

279283
## Collect traces from non-Lambda resources
@@ -723,6 +727,50 @@ You can use this approach if, for example, your code has already been instrument
723727
724728
To instrument AWS Lambda with the OpenTelemetry API, set the environment variable `DD_TRACE_OTEL_ENABLED` to `true`. See [Custom instrumentation with the OpenTelemetry API][48] for more details.
725729
730+
## Using Datadog Lambda Extension v67+
731+
Version 67+ of [the Datadog Extension][53] is optimized to significantly reduce cold start duration.
732+
To use the optimized extension, set the `DD_SERVERLESS_APPSEC_ENABLED` environment variable to `false`.
733+
When the `DD_SERVERLESS_APPSEC_ENABLED` environment variable is set to `true`, the Datadog Extension defaults to the fully compatible older version. You can also force your extension to use the older version by setting `DD_EXTENSION_VERSION` to `compatibility`. Datadog encourages you to report any feedback or bugs by adding an [issue on GitHub][54] and tagging your issue with `version/next`.
734+
735+
## Configure Auto-linking for DynamoDB PutItem
736+
_Available for Python and Node.js runtimes_.
737+
When segments of your asynchronous requests cannot propagate trace context, Datadog's [Span Auto-linking][55] feature automatically detects linked spans.
738+
To enable Span Auto-linking for [DynamoDB Change Streams][56]' `PutItem` operation, configure primary key names for your tables.
739+
740+
{{< tabs >}}
741+
{{% tab "Python" %}}
742+
```python
743+
ddtrace.config.botocore['dynamodb_primary_key_names_for_tables'] = {
744+
'table_name': {'key1', 'key2'},
745+
'other_table': {'other_key'},
746+
}
747+
```
748+
{{% /tab %}}
749+
{{% tab "Node.js" %}}
750+
```js
751+
// Initialize the tracer with the configuration
752+
const tracer = require('dd-trace').init({
753+
dynamoDb: {
754+
tablePrimaryKeys: {
755+
'table_name': ['key1', 'key2'],
756+
'other_table': ['other_key']
757+
}
758+
}
759+
})
760+
```
761+
{{% /tab %}}
762+
{{% tab "Environment variable" %}}
763+
```sh
764+
export DD_BOTOCORE_DYNAMODB_TABLE_PRIMARY_KEYS='{
765+
"table_name": ["key1", "key2"],
766+
"other_table": ["other_key"]
767+
}'
768+
```
769+
{{% /tab %}}
770+
{{< /tabs >}}
771+
772+
This enables DynamoDB `PutItem` calls to be instrumented with span pointers. Many DynamoDB API calls do not include the item's primary key fields as separate values, so they need to be provided to the tracer separately. The configuration above is structured as a dictionary (`dict`) or object keyed by the table names as strings (`str`). Each value is the set of primary key field names (as strings) for the associated table. The set can have exactly one or two elements, depending on the table's primary key schema.
773+
726774
## Visualize and model AWS services by resource name
727775

728776
These versions of the [Node.js][50], [Python][51], and [Java][52] Lambda layers released changes to correctly name, model and visualize AWS managed services.
@@ -801,3 +849,8 @@ If you have trouble configuring your installations, set the environment variable
801849
[50]: https://github.com/DataDog/datadog-lambda-js/releases/tag/v12.127.0
802850
[51]: https://github.com/DataDog/datadog-lambda-python/releases/tag/v8.113.0
803851
[52]: https://github.com/DataDog/datadog-lambda-java/releases/tag/v24
852+
[53]: https://github.com/DataDog/datadog-lambda-extension
853+
[54]: https://github.com/DataDog/datadog-lambda-extension/issues
854+
[55]: /serverless/aws_lambda/distributed_tracing/#span-auto-linking
855+
[56]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.html
856+
[57]: /tracing/guide/aws_payload_tagging/?code-lang=python&tab=nodejs

content/en/serverless/aws_lambda/installation/_index.md

Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Instrument AWS Lambda applications
3+
aliases:
4+
- /serverless/installation/installing_the_library/
5+
- /serverless/installation
6+
- /serverless/aws_lambda/installation
7+
further_reading:
8+
- link: '/serverless/configuration/'
9+
tag: 'Documentation'
10+
text: 'Configure Serverless Monitoring'
11+
- link: "/integrations/amazon_lambda/"
12+
tag: "Documentation"
13+
text: "AWS Lambda Integration"
14+
---
15+
16+
## Overview
17+
18+
Instrument your AWS Lambda applications with a Datadog Lambda Library to collect traces, enhanced metrics, and custom metrics.
19+
20+
{{< img src="serverless/serverless_tracing_installation_instructions.png" alt="A diagram that shows how Datadog receives telemetry from your instrumented AWS Lambda application. Your Lambda application, instrumented with a Datadog Lambda Library, sends logs, traces, enhanced metrics, and custom metrics to the Datadog Lambda Extension, which then pushes this data to Datadog." style="width:100%;" >}}
21+
22+
## Quick start
23+
24+
A sample application is [available on GitHub][6] with instructions on how to deploy with multiple runtimes and infrastructure-as-code tools.
25+
26+
The quick start process configures your Lambda functions on the fly. To instrument Lambda functions permanently, see the detailed instructions in the next section.
27+
28+
## Instrumentation instructions
29+
30+
For Node.js and Python runtimes, you can use [remote instrumentation][5] to add instrumentation to your AWS Lambda functions and keep them instrumented securely. See [Remote instrumentation for AWS Lambda][5].
31+
32+
For other Lambda runtimes (or to instrument your Node.js or Python functions without remote instrumentation) see detailed instrumentation instructions:
33+
34+
{{< partial name="serverless/getting-started-languages.html" >}}
35+
36+
## Advanced configurations
37+
38+
After you're done with instrumentation and you've set up telemetry collection, you can use [Configure Serverless Monitoring for AWS Lambda][3] to:
39+
40+
- connect your metrics, traces, and logs using tags
41+
- collect telemetry from AWS resources such as API Gateway, AppSync, and Step Functions
42+
- capture the request and response payloads for individual Lambda invocations
43+
- link errors of your Lambda functions to your source code
44+
- filter or scrub sensitive information from logs or traces
45+
46+
## Further Reading
47+
48+
{{< partial name="whats-next/whats-next.html" >}}
49+
50+
[1]: https://app.datadoghq.com/signup/
51+
[2]: https://app.datadoghq.com/signup/agent#lambda
52+
[3]: /serverless/aws_lambda/configuration/
53+
[4]: /serverless/aws_lambda/fips-compliance/
54+
[5]: /serverless/aws_lambda/remote_instrumentation
55+
[6]: https://github.com/DataDog/serverless-sample-app

content/en/serverless/aws_lambda/installation/dotnet.md renamed to content/en/serverless/aws_lambda/instrumentation/dotnet.md

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Instrumenting .NET Serverless Applications
33
aliases:
44
- /serverless/installation/dotnet
5+
- /serverless/aws_lambda/installation/dotnet
56
further_reading:
67
- link: '/serverless/configuration'
78
tag: 'Documentation'
@@ -14,17 +15,11 @@ further_reading:
1415
text: 'Submitting Custom Metrics from Serverless Applications'
1516
---
1617

17-
<div class="alert alert-warning">If your Lambda functions are deployed in VPC without access to the public internet, you can send data either <a href="/agent/guide/private-link/">using AWS PrivateLink</a> for the <code>datadoghq.com</code> <a href="/getting_started/site/">Datadog site</a>, or <a href="/agent/configuration/proxy/">using a proxy</a> for all other sites.</div>
18+
<div class="alert alert-info">Version 67+ of the Datadog Lambda Extension is optimized to significantly reduce cold start duration. <a href="/serverless/aws_lambda/configuration/?tab=datadogcli#using-datadog-lambda-extension-v67">Read more</a>.</div>
1819

19-
<div class="alert alert-info">Version 67+ of the Datadog Lambda Extension uses an optimized version of the extension. <a href="#minimize-cold-start-duration">Read more</a>.</div>
20+
## Setup
2021

21-
<div class="alert alert-info">For FIPS compliance, use the Datadog FIPS-compliant extension layer, but note that the .NET runtime layer does not require additional configuration. While the FIPS-compliant Lambda components work with any Datadog site, end-to-end FIPS compliance requires using the US1-FED site. See <a href="/serverless/aws_lambda/fips-compliance">AWS Lambda FIPS Compliance</a> for more details.</div>
22-
23-
## Installation
24-
25-
<div class="alert alert-info">A sample application is <a href="https://github.com/DataDog/serverless-sample-app/tree/main/src/order-service">available on GitHub</a> with instructions on how to deploy with multiple runtimes and infrastructure as code tools.</div>
26-
27-
Datadog offers many different ways to enable instrumentation for your serverless applications. Choose a method below that best suits your needs. Datadog generally recommends using the Datadog CLI. You *must* follow the instructions for "Container Image" if your application is deployed as a container image.
22+
If your application is deployed as a container image, use the _Container Image_ method.
2823

2924
{{< tabs >}}
3025
{{% tab "Datadog CLI" %}}
@@ -304,40 +299,30 @@ module "lambda-datadog" {
304299
{{% /tab %}}
305300
{{< /tabs >}}
306301

307-
## Minimize cold start duration
308-
Version 67+ of [the Datadog Extension][7] is optimized to significantly reduce cold start duration.
309-
310-
To use the optimized extension, disable App and API Protection (AAP), Continuous Profiler for Lambda, and OpenTelemetry based tracing. Set the following environment variables to `false`:
311-
312-
- `DD_TRACE_OTEL_ENABLED`
313-
- `DD_PROFILING_ENABLED`
314-
- `DD_SERVERLESS_APPSEC_ENABLED`
315-
316-
Enabling any of these features cause the extension to default back to the fully compatible older version of the extension. You can also force your extension to use the older version by setting `DD_EXTENSION_VERSION` to `compatibility`. Datadog encourages you to report any feedback or bugs by adding an [issue on GitHub][8] and tagging your issue with `version/next`.
302+
## Add custom spans
317303

318-
## Adding Custom Spans
319-
320-
When using the [Datadog Lambda tracing layer for .NET](https://github.com/DataDog/dd-trace-dotnet-aws-lambda-layer), ensure that a second version of the .NET tracer is not also packaged with your application code. Add `ExcludeAssets` instruction to ensure this extra tracer is excluded.
304+
When using the [Datadog Lambda tracing layer for .NET][9], ensure that a second version of the .NET tracer is not also packaged with your application code. Add the `ExcludeAssets` instruction to ensure this extra tracer is excluded.
321305

322306
```xml
323307
<PackageReference Include="Datadog.Trace" Version="2.38.0">
324308
<ExcludeAssets>runtime</ExcludeAssets>
325309
</PackageReference>
326310
```
327311

328-
You are now ready to add custom spans and span tags using the .NET tracer. For further instructions on how to add spans, see the [.NET custom instrumentation](https://docs.datadoghq.com/tracing/trace_collection/custom_instrumentation/dotnet/dd-api/) page.
312+
You can then add custom spans and span tags using the .NET tracer. For instructions on how to add spans, see [.NET custom instrumentation][10].
313+
314+
## FIPS compliance
315+
316+
{{% svl-lambda-fips %}}
317+
318+
## AWS Lambda and VPC
319+
320+
{{% svl-lambda-vpc %}}
329321

330-
## What's next?
331-
- View metrics, logs, and traces on the [Serverless page][1] in Datadog. By default, the Datadog Lambda extension enables logs.
332-
- Turn on [threat monitoring][6] to get alerted on attackers targeting your service.
333-
- Submit a [custom metric][2] or [APM span][3] to monitor your business logic.
334-
- See the [troubleshooting guide][4] if you have trouble collecting the telemetry
335-
- See the [advanced configurations][5] to
336-
- connect your telemetry using tags
337-
- collect telemetry for Amazon API Gateway, SQS, and so on.
338-
- capture the Lambda request and response payloads
339-
- link errors of your Lambda functions to your source code
340-
- filter or scrub sensitive information from logs or traces
322+
- Add custom tags to your telemetry by using the `DD_TAGS` environment variable
323+
- Configure [payload collection][11] to capture your functions' JSON request and response payloads
324+
- If you are using the Datadog Lambda Extension, turn off the Datadog Forwarder's Lambda logs
325+
- See [Configure Serverless Monitoring for AWS Lambda][5] for further capabilities
341326

342327
## Further Reading
343328

@@ -352,3 +337,6 @@ You are now ready to add custom spans and span tags using the .NET tracer. For f
352337
[6]: /security/application_security/serverless/
353338
[7]: https://github.com/DataDog/datadog-lambda-extension
354339
[8]: https://github.com/DataDog/datadog-lambda-extension/issues
340+
[9]: https://github.com/DataDog/dd-trace-dotnet-aws-lambda-layer
341+
[10]: https://docs.datadoghq.com/tracing/trace_collection/custom_instrumentation/dotnet/dd-api/
342+
[11]: /serverless/aws_lambda/configuration?tab=datadogcli#collect-the-request-and-response-payloads

0 commit comments

Comments
 (0)