Monitoring Lambda functions with Datadog
The “serverless” movement is taking the industry by storm and now, with Datadog, you can start monitoring your serverless applications and functions on AWS Lambda.
As soon as you enable the Lambda integration, you’ll start to see your metrics in an out-of-the-box dashboard like the one above.
AWS Lambda is an event-driven compute service that abstracts away the underlying infrastructure, allowing developers to focus on their code rather than the execution environment. Lambda functions can be triggered via API, by in-app actions, or by AWS events, such as a new object being added to an S3 bucket. Since its debut in 2014, Lambda adoption has flourished, with a rich ecosystem of tooling and frameworks developing around it, and adoption by large companies like Netflix and Nordstrom.
As part of AWS, Lambda integrates with several AWS services you may already be using. These services include: EC2, ELB, SES, and S3. Its affordability, reliability, convenience, and native integration with other AWS services make Lambda the go-to computation-as-a-service platform.
Monitoring in a serverless environment
Monitoring Lambda function execution and performance is a bit different than monitoring a traditional application server. With no “host” in the traditional sense (and thus nowhere to run standard diagnostic and monitoring tools) monitoring Lambdas without living in the AWS management console can be challenging.
Peeling back the curtain
With Datadog’s integration with AWS Lambda, you can now visualize and alert on Lambda metrics, and put them in context with operational data from the rest of your infrastructure. Instead of clicking through the AWS console for your function’s execution metrics, now you can see them all in one place.
Show me the metrics!
Using the new Lambda integration, you’ll be able to alert on and visualize the following metrics on your functions’ execution:
- execution times
- invocation errors
- throttled functions
Slice ‘em up with tags
The integration will automatically add the following tags to all of the Lambda metrics we collect, so you can slice and dice anyway you like:
functionname: the name of the Lambda function
region: the region in which the Lambda is “located”
Beyond standard metrics
Our integration with Lambda also supports custom metrics, so you can monitor function-specific metrics alongside metrics from the rest of your infrastructure.
To start sending your own custom metrics, print a log line from your Lambda function, following this DogStatsD-style format:
where metric_type is either
You can also use the Datadog HTTP API to submit custom metrics from your Lambda function.
If you haven’t already integrated AWS with Datadog, take a minute to do so before continuing.
Next, verify you’ve granted your Datadog role/user the following permissions:
Flip the switch
Once you’ve integrated Datadog with Amazon Web Services, you can turn on the integration right now, and add AWS Lambda to the ever-growing list of technologies you can monitor easily and collaboratively. If you’re new to Datadog, get started with a 14-day trial.