Any tag applied to your AWS Lambda function automatically becomes a new dimension on which you can slice and dice your traces.
Tags are especially powerful when consistent across the Datadog platform. First-class support is offered for the following tags:
With these two tags, you can:
There are a few best practices Datadog recommends for tagging in your serverless environment to keep tags consistent across your traces, metrics, and logs.
To surface tags from your Lambda functions across metrics, traces, and logs, Datadog recommends that you directly tag your Lambda functions with the appropriate
service. Below are some sample tagging configurations for common serverless developer tools:
If you are using the Serverless Framework, you can choose one of several options to apply tags across Datadog:
provider: name: aws runtime: nodejs12.x tags: service: shopist-cart-confirmation env: prod version: 1.01
functions: confirmCart: handler: cart.confirm tags: service: shopist-cart-confirmation env: prod version: 1.01 events: - http: path: ping method: get
stagetags will be surfaced as
service: shopist-cart-confirmation provider: name: aws runtime: nodejs12.x stage: prod
If you are using the AWS SAM, you can choose one of several options to apply tags across Datadog:
Resources: confirmCart: Type: AWS::Serverless::Function Properties: Handler: src/handlers/cart.confirm Tags: env: prod service: shopist-cart-confirmation
Transformscope will be applied across Datadog:
Transform: - AWS::Serverless-2016-10-31 - Name: DatadogServerless Parameters: nodeLayerVersion: 25 forwarderArn: "arn:aws:lambda:us-east-1:000000000000:function:datadog-forwarder" stackName: !Ref "AWS::StackName" service: "shopist-cart-confirmation" env: "prod"
Datadog strongly recommends you enable the
DdFetchLambdaTags option on the Datadog Forwarder. Setting the parameter
true on the Forwarder CloudFormation stack will ensure your traces are tagged with the resource tags on the originating Lambda function.
Lambda function resource tags are automatically surfaced to X-Ray traces in Datadog without any additional configuration.
env to separate out your staging, development, and production environments. This works for any kind of infrastructure, not just for your serverless functions. As an example, you could tag your production EU Lambda functions with
By default, AWS Lambda functions are tagged with
env:none in Datadog. Add your own tag to override this.
service tag in order to group related Lambda functions into a service. The Service Map and Services List use this tag to show relationships between services and the health of their monitors. Services are represented as individual nodes on the Service Map.
The default behavior for new Datadog customers is for all Lambda functions to be grouped under the
aws.lambda service, and represented as a single node on the Service map. Tag your functions by service to override this.
Note: For some Datadog customers, each Lambda function is treated as its own service. Add your own tag to override this, or reach out to Datadog Support if you would like to your account to adopt the new behavior.