Deciding to migrate to the Datadog Lambda extension

Should I migrate to the Datadog Lambda extension?

AWS Lambda extensions run within the Lambda execution environment, alongside your Lambda function code. Datadog partnered with AWS to create the Datadog Lambda extension, a lightweight version of the Datadog Agent that submits custom metrics, enhanced metrics, traces, and logs.

If you configured Datadog Serverless before the introduction of the Datadog Lambda extension, you are likely using the Datadog Forwarder to submit custom metrics, enhanced metrics, traces, and logs.

There are some key differences between the Lambda extension and the Forwarder, as well as certain situations where you may find it advantageous to use one over the other. This page describes the various reasons you may or may not choose to migrate from the Forwarder to the Lambda extension.

Differences in functionality

Instrument AWS Serverless Applications

Although the Lambda Extension replaces the Forwarder as the recommended way to collect telemetry from Lambda functions, the Forwarder is required to collect and add metadata to other AWS service logs — including those from API Gateway, AppSync, and Lambda@Edge.

Advantages

The Datadog Lambda Extension offers the following advantages over the Datadog Forwarder:

  • Skip CloudWatch Logs: The Forwarder extracts telemetry from logs, which are then sent to Datadog. The Datadog Lambda Extension sends telemetry directly to Datadog, enabling you to reduce the cost associated with CloudWatch Logs.
  • Simple to set up: The Datadog Lambda extension can be added as a Lambda layer and sends telemetry directly to Datadog, so you do not need to set up a subscription filter for every new Lambda function’s CloudWatch log group.

Trade-offs

The extension adds overhead to your Lambda functions, compared to functions that have zero instrumentation. The added overhead affects your AWS bill and Lambda concurrency, and could cause worse cold starts. The majority of the added duration does not affect your function’s performance. Based on Datadog’s latest benchmarking results, the cost overhead is always lower (or about the same when reporting data from remote regions) when using the Lambda extension versus the Forwarder.

Migrate to the Datadog Lambda Extension

To migrate from the the Datadog Forwarder to the Datadog Lambda Extension, see the Serverless configuration documentation.

Further Reading

Additional helpful documentation, links, and articles: