Learn about the Wavefront AWS Lambda Functions Integration.

AWS Lambda Functions Integration

In a Function-as-a-Service (FaaS) environment, also called a serverless environment, code runs in response to events. AWS Lambda is one implementation of this paradigm: After you define a Lambda function, the AWS Lambda service will run it in response to events. Because Lambda functions are stateless, AWS Lambda can run as many copies of the function as needed, rapidly scaling up or scaling down in response to incoming events.

This integration allows you to instrument your Lambda function to report custom metrics to Wavefront. Additionally, this integration reports the following standard metrics about your Lambda functions:

  • aws.lambda.wf.invocations.count: Lambda function invocations (Delta Counter)
  • aws.lambda.wf.errors.count: Lambda function errors (Delta Counter)
  • aws.lambda.wf.coldstarts.count: Lambda function cold starts (Delta Counter)
  • aws.lambda.wf.duration.value: Execution time of the Lambda function handler in milliseconds (Gauge)

The Lambda wrapper also adds the following point tags automatically to all metrics sent to Wavefront:

  • LambdaArn: ARN (Amazon Resource Name) of the Lambda function.
  • Region: AWS Region of the Lambda function.
  • accountId: AWS Account ID from which the Lambda function was invoked.
  • ExecutedVersion: Version of the Lambda function.
  • FunctionName: Name of the Lambda function.
  • Resource: Name and version/alias of the Lambda function. (Ex: DemoLambdaFunc:aliasProd)
  • EventSourceMappings: AWS Event source mapping Id. (Set in case of Lambda invocation by AWS poll-based Services)

In addition to setting up the metrics, this integration also installs a dashboard:


AWS Lambda Functions Setup

Wavefront provides Lambda function wrappers, which allow you to send custom metrics from your Lambda functions and collect standard Lambda metrics for Python, Go and Node.js.

Configure Wavefront Lambda Wrapper

The Wavefront AWS Lambda function wrappers use the following environment variables:

  • WAVEFRONT_URL: https://YOUR_CLUSTER.wavefront.com
  • WAVEFRONT_API_TOKEN: YOUR_API_TOKEN (Wavefront API token with Direct Data Ingestion permission).
  • REPORT_STANDARD_METRICS: Optional. Set to False to omit reporting standard Lambda metrics.

Python Lambda Wrapper

To report metrics from your Python Lambda functions, use the Wavefront Python Lambda Wrapper.

Install wavefront_lambda

pip install wavefront_lambda


Decorate your Python AWS Lambda function handler with @wavefront_lambda.wrapper:

import wavefront_lambda

def handler(event, context):
    # your code

Go Lambda Wrapper

To report metrics from your Go Lambda functions, use the Wavefront Go Lambda Wrapper.

Install wavefront-lambda

go get github.com/wavefronthq/wavefront-lambda-go


Wrap your Go AWS Lambda function handler with wflambda.Wrapper:

package main

import (

func HandleLambdaRequest() {
	// your code

func main() {
	// Wrap your Lambda function handler with wflambda.Wrapper

Node.js Lambda Wrapper

To report metrics from your Node.js Lambda functions, use the Wavefront Node.js Lambda Wrapper.

Install wavefront-lambda

npm install wavefront-lambda


Wrap your Node.js AWS Lambda function handler with wavefrontLambda.wrapper:

const wavefrontLambda = require('wavefront-lambda')
const metrics = require('wavefrontmetrics');

exports.myHandler = wavefrontLambda.wrapper( function(event, context, callback) {
                //your code