Deciding to migrate to the Datadog Lambda extension

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

The Lambda extension only supports sending Lambda function telemetry for specific runtimes. The Forwarder is required to collect and add metadata to other AWS service logs, including those from API Gateway, AppSync, and Lambda@Edge.

RuntimeExtension supportForwarder support
Python
Node.js
Go
Java
.NET
Ruby
PHP

The Lambda extension has full feature parity with the Forwarder for Python, Node.js, and Go runtimes. The Lambda extension can submit Lambda logs, Lambda traces generated by dd-trace (not X-Ray), real-time enhanced Lambda metrics, and custom metrics generated by Lambda functions.

Advantages

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

  • Simple to set up: The Forwarder requires that triggers need be set up for every new Lambda function. The Datadog Lambda extension can be easily added as a Lambda layer. Unlike with the Forwarder, configuring the Lambda extension does not require permissions to install third-party AWS CloudFormation stacks. Also, the Lambda extension sends telemetry directly to Datadog, so you do not need to manage CloudWatch Log group subscriptions for your Lambda functions.
  • Less infrastructure to manage: The simpler configuration of the Lambda extension saves time on infrastructure management. For non-Lambda AWS integrations, the Forwarder is still required.
  • Skip CloudWatch Logs: The Forwarder converts logs to metrics and traces, which are then sent to Datadog. The Datadog Lambda Extension sends traces, metrics, and logs directly to Datadog, enabling you to reduce the cost associated with CloudWatch Logs.

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.