Amazon Lambda
New announcements from Dash: Incident Management, Continuous Profiler, and more! New announcements from Dash!

Amazon Lambda

Crawler Crawler
This page is limited to documentation for ingesting AWS Lambda metrics from Amazon CloudWatch. Please refer to updated Datadog Serverless Monitoring documentation here.

Overview

Amazon Lambda is a compute service that runs code in response to events and automatically manages the compute resources required by that code.

Enable this integration to begin collecting CloudWatch metrics. This page also describes how to set up custom metrics, logging, and tracing for your Lambda functions.

Setup

Installation

If you haven’t already, set up the Amazon Web Services integration first.

Metric collection

AWS Lambda metrics

  1. In the AWS integration tile, ensure that Lambda is checked under metric collection.
  2. Add the following permissions to your Datadog IAM policy to collect Amazon Lambda metrics. For more information on Lambda policies, review the documentation on the AWS website.

    AWS PermissionDescription
    lambda:List*List Lambda functions, metadata, and tags.
    tag:GetResourcesGet custom tags applied to Lambda functions.
  3. Install the Datadog - AWS Lambda integration.

Once this is completed, view all of your Lambda Functions in the Datadog Serverless view. This page brings together metrics, traces, and logs from your AWS Lambda functions running serverless applications into one view. Detailed documentation on this feature can be found in the Datadog Serverless documentation.

Data Collected

Metrics

aws.lambda.duration
(gauge)
Measures the average elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as millisecond
aws.lambda.duration.maximum
(gauge)
Measures the maximum elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as millisecond
aws.lambda.duration.minimum
(gauge)
Measures the minimum elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as millisecond
aws.lambda.duration.sum
(gauge)
Measures the total execution time of the lambda function executing.
Shown as millisecond
aws.lambda.duration.p80
(gauge)
Measures the p80 elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as millisecond
aws.lambda.duration.p95
(gauge)
Measures the p95 elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as millisecond
aws.lambda.duration.p99
(gauge)
Measures the p99 elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as millisecond
aws.lambda.duration.p99.9
(gauge)
Measures the p99.9 elapsed wall clock time from when the function code starts executing as a result of an invocation to when it stops executing.
Shown as millisecond
aws.lambda.timeout
(gauge)
Measures the amount of allowed execution time for the function before the Lambda runtime stops it.
Shown as second
aws.lambda.memorysize
(gauge)
Measures the amount of allocated memory available to the function during execution.
Shown as mebibyte
aws.lambda.errors
(count)
Measures the number of invocations that failed due to errors in the function (response code 4XX).
Shown as error
aws.lambda.invocations
(count)
Measures the number of times a function is invoked in response to an event or invocation API call.
Shown as invocation
aws.lambda.throttles
(count)
Measures the number of Lambda function invocation attempts that were throttled due to invocation rates exceeding the customer's concurrent limits (error code 429). Failed invocations may trigger a retry attempt that succeeds.
Shown as throttle
aws.lambda.iterator_age
(gauge)
Measures the age of the last record for each batch of records processed
Shown as millisecond
aws.lambda.iterator_age.minimum
(gauge)
Measures the minimum age of the last record for each batch of records processed
Shown as millisecond
aws.lambda.iterator_age.maximum
(gauge)
Measures the maximum age of the last record for each batch of records processed
Shown as millisecond
aws.lambda.iterator_age.sum
(gauge)
Measures the sum of the ages of the last record for each batch of records processed
Shown as millisecond
aws.lambda.dead_letter_errors
(count)
Measures the sum of times Lambda is unable to write the failed event payload to your configured Dead Letter Queues.
Shown as error
aws.lambda.concurrent_executions
(gauge)
Measures the average of concurrent executions for a given function at a given point in time.
Shown as execution
aws.lambda.concurrent_executions.minimum
(gauge)
Measures the minimum of concurrent executions for a given function at a given point in time.
Shown as execution
aws.lambda.concurrent_executions.maximum
(gauge)
Measures the maximum of concurrent executions for a given function at a given point in time.
Shown as execution
aws.lambda.concurrent_executions.sum
(gauge)
Measures the sum of concurrent executions for a given function at a given point in time.
Shown as execution
aws.lambda.concurrent_executions_global
(gauge)
Measures the average of concurrent executions for all functions in an account at a given point in time.
Shown as execution
aws.lambda.concurrent_executions_global.minimum
(gauge)
Measures the minimum of concurrent executions for all functions in an account at a given point in time.
Shown as execution
aws.lambda.concurrent_executions_global.maximum
(gauge)
Measures the maximum of concurrent executions for all functions in an account at a given point in time.
Shown as execution
aws.lambda.concurrent_executions_global.sum
(gauge)
Measures the sum of concurrent executions for all functions in an account at a given point in time.
Shown as execution
aws.lambda.unreserved_concurrent_executions
(gauge)
Measures the sum of the concurrency of the functions that don't have a custom concurrency limit specified.
Shown as execution
aws.lambda.provisioned_concurrent_executions
(gauge)
Measures the average number of events that are being processed on provisioned concurrency
Shown as execution
aws.lambda.provisioned_concurrent_executions.minimum
(gauge)
Measures the minimum number of events that are being processed on provisioned concurrency
Shown as execution
aws.lambda.provisioned_concurrent_executions.maximum
(gauge)
Measures the maximum number of events that are being processed on provisioned concurrency
Shown as execution
aws.lambda.provisioned_concurrency_invocations
(count)
Measures the number of invocations that are run on provisioned concurrency
Shown as invocation
aws.lambda.provisioned_concurrency_spillover_invocations
(count)
Measures the number of invocations that are run on non-provisioned concurrency when all provisioned concurrency is in use
Shown as invocation
aws.lambda.provisioned_concurrency_utilization
(gauge)
Measures the average fraction of provisioned concurrency in use for a given function at a given point in time
Shown as percent
aws.lambda.provisioned_concurrency_utilization.minimum
(gauge)
Measures the minimum fraction of provisioned concurrency in use for a given function at a given point in time
Shown as percent
aws.lambda.provisioned_concurrency_utilization.maximum
(gauge)
Measures the maximum fraction of provisioned concurrency in use for a given function at a given point in time
Shown as percent

Each of the metrics retrieved from AWS is assigned the same tags that appear in the AWS console, including but not limited to function name, security-groups, and more.

Custom metrics are only tagged with function name.

Events

The AWS Lambda integration does not include any events.

Service Checks

The AWS Lambda integration does not include any service checks.

Serverless Monitoring

Real-time enhanced Lambda metrics

Datadog generates real-time Lambda runtime metrics out-of-the-box for Node.js, Python, and Ruby runtimes. Please refer to updated Serverless Monitoring documentation here to learn more.

Enabling enhanced real-time Lambda metrics

Please refer to updated Serverless Monitoring documentation here to learn more.

Log collection

Please refer to updated Serverless Monitoring documentation here to learn more.

Trace collection

Datadog supports distributed tracing for your AWS Lambda functions using either Datadog APM or AWS X-Ray. You can use either set of client libraries to generate traces, and Datadog APM will connect traces from applications running on hosts, containers, and serverless functions automatically. Please refer to updated Serverless Monitoring documentation here to learn more.

Tracing with Datadog APM

The Datadog Node.js, Python, and Ruby tracing libraries support distributed tracing for AWS Lambda, with more runtimes coming soon. The easiest way to add tracing to your application is with the Datadog Lambda Library, which includes the Datadog tracing library as a dependency. Please refer to updated Serverless Monitoring documentation here to learn more.

Tracing across AWS Lambda and hosts

When applicable, Datadog merges AWS X-Ray traces with native Datadog APM traces. This means that your traces will show the complete picture of requests that cross infrastructure boundaries, whether it be AWS Lambda, containers, on-prem hosts, or managed services. Please refer to updated Serverless Monitoring documentation here to learn more.

Organizing your infrastructure with tags

Any tag applied to your Lambda function automatically becomes a new dimension on which your can slice and dice your traces. Please refer to updated Serverless Monitoring documentation here to learn more.

Serverless Integrations

The following Lambda function integrations provide additional functionality for monitoring serverless applications:

AWS Step Functions

Please refer to updated Serverless Monitoring documentation here to learn more.

Amazon EFS for Lambda

Please refer to updated Serverless Monitoring documentation here to learn more.

Lambda@Edge

Please refer to updated Serverless Monitoring documentation here to learn more.

Custom metrics

Install the Datadog Lambda Library to collect and send custom metrics. Please refer to updated Serverless Monitoring documentation here to learn more.

Upgrading to distribution metrics

With distribution metrics, you select the aggregation when graphing or querying it instead of specifying it at submission time. Please refer to updated Serverless Monitoring documentation here to learn more.

Tagging custom metrics

Please refer to updated Serverless Monitoring documentation here to learn more.

Synchronous vs. asynchronous custom metrics

Please refer to updated Serverless Monitoring documentation here to learn more.

Enabling asynchronous custom metrics

Please refer to updated Serverless Monitoring documentation here to learn more.

Custom metrics sample code

In your function code, you must import the necessary methods from the Lambda Layer and add a wrapper around your function handler. Please refer to updated Serverless Monitoring documentation here to learn more.

Running in a VPC

Please refer to updated Serverless Monitoring documentation here to learn more.

Using Third-Party Libraries

TPlease refer to updated Serverless Monitoring documentation here to learn more.

[DEPRECATED] Using CloudWatch Logs

Please refer to updated Serverless Monitoring documentation here to learn more.

Datadog Lambda Layer

Please refer to updated Serverless Monitoring documentation here to learn more.

Installing and using the Datadog Lambda Layer

Please refer to updated Serverless Monitoring documentation here to learn more.

Troubleshooting

Need help? Contact Datadog support.

Further Reading