Cloud functions are a service that run your code in response to events and automatically manage the underlying compute resources for you. Datadog Cloud Functions brings together metrics, traces, and logs from your AWS Lambda functions running serverless applications into one view.
The Cloud Functions dashboard requires no installation of its own, but it relies on three data sources that require their own installation:
Amazon Web Services integration (required)
This integration populates the summary graphs and the main functions table. Install this integration and ensure that Lambda metrics are reporting in your account.
Note: Metrics in the Cloud Function UI are delayed ~10 minutes, as this is the default speed at which Datadog polls AWS APIs. To find out if your delay can be decreased, contact Datadog support.
AWS X-Ray integration (optional) This integration provides traces for Lambda functions in the function detail page.
Install the X-Ray integration and add the following permissions to the policy document in your AWS/Datadog Role:
If using a Customer Master Key to encrypt traces, add the
kms:Decrypt method to your policy where the Resource is the Customer Master Key used for X-Ray.
Recommended X-Ray setup:
Navigate to the Lambda function in the AWS console you want to instrument. In the “Debugging and error handling” section, check the box to “Enable active tracing”. This turns on X-Ray for that function.
Import the X-Ray SDK in your function, and patch all supported libraries. This automatically causes X-Ray to trace all AWS calls and other X-Ray supported integrations. See an example of this in Python.
Datadog’s X-Ray integration supports custom subsegments and annotations as well.
Note: Traces are delayed ~5 minutes, as this is the speed at which Datadog polls AWS X-Ray APIs.
AWS CloudWatch Logs (optional)
Install this if you want to see logs from your Lambda functions in the function detail page. This also populates the additional metrics such as Memory Used (avg) and Last Start in your functions table.
To enable this, refer to the documentation for sending Lambda logs to Datadog.
Datadog tags your Lambda functions and metrics with relevant AWS metadata and custom tags.
In your Datadog IAM policy, add the permissions:
lambda:List*to have the tags above collected.
tag:GetResourcesto have custom tags collected.
Use the faceted search functionality along the left side of the page to narrow down the functions that are in view. All AWS and custom tags are available to use as filters.
Using the settings gear, you can check and uncheck metric columns on the functions table. Below is a list of metrics, the associated integration type, and if the column is displayed by default:
|Dead Letter Errors||Metric||No|
|% Memory Used||Logs||No|
Clicking on a particular function in the function summary table brings you to a function detail page. This page provides detailed trace and log level information for that function.
Use the summary graphs across the top of screen and the time selector to focus in on a specific time frame you are interested in. The entire page, including the traces and logs shown, updates when you use the time selector.
Via the AWS X-Ray integration, traces from the function currently being viewed are shown in the
Traces section. You can sort these traces by attributes such as date, duration, and status.
Logs section aggregates logs from all recent invocations of the current function. It updates live as your functions send new logs to Datadog.
Clicking on a particular trace opens the trace detail view for that trace. The X-Ray subsegments are transformed into Datadog spans while preserving the naming paradigms, span metadata, and structure of the overall trace.
Datadog provides specially formatted serverless traces for readability and usability. Clicking on the span from another Lambda function creates a link to that function’s detail page so you can easily jump to another function that is part of the trace.
All logs emitted from that function, and all functions it calls, are pulled into the function detail page as well. Narrow down the timeframe of the page to a specific moment of interest to view the logs during a critical point in time. Click on the logs in the table to see the full log in more detail.
The errors tab bubbles up exceptions that occured during the duration of the trace. This is useful for quickly understanding what went wrong during execution.