Lambda Functions

The Epsagon agents allow you to collect and monitor your functions for metrics, traces, calls, and correlation to logs.

Auto-tracing for Node.js and Python functions

Using the Epsagon dashboard you can easily enable tracing for Node.js and Python functions.


AWS Lambda Auto-Tracing

This feature changes the functions' configuration by adding a layer and setting a new handler.
We recommend getting started with a few functions in development.

To enable auto-tracing, go to the functions screen, checkmark the desired functions on the left side, and under actions, click enable auto-tracing:

To disable, follow the same instructions, but under actions select disable auto-tracing:

Calling the SDK

You can manually call the Epsagon SDK library inside your Lambda functions.
Install our library according to your runtime:

npm install epsagon
pip install --upgrade epsagon
<!--Add the epsagon dependecy to your pom.xml-->
  <version>{Epsagon version}</version>
dotnet add package Epsagon.Dotnet.Lambda
# Using go get
go get

# Using dep
dep ensure -add

Inside your function handler (where you get the event and context) add the following snippet, and wrap the handler:

const epsagon = require('epsagon');
    token: '<epsagon-token>',
    appName: '<app-name-stage>',
    metadataOnly: false,

// Wrap your entry point
module.exports.handler = epsagon.lambdaWrapper((event, context, callback) => {
  // Your code is here

// Async functions supported
module.exports.handler = epsagon.lambdaWrapper(async (event) => {
  // Your code is here
import epsagon

# Wrap your entry point
def handle(event, context):
    # Your code is here
import com.epsagon.EpsagonRequestHandler;

// Make sure class extends com.epsagon.EpsagonRequestHandler
public class EpsagonWrapper extends EpsagonRequestHandler {
    static {
        try {
        } catch (Exception e) {
// either a) inherit from Epsagon's LambdaHander base class
// or b) pass handler through EpsagonHandler's callback

// inheriting from Epsagon's base LambdaHandler
public class Function : LambdaHandler<S3Event, string>
    // handler function
    public override string HandlerFunction(S3Event input, ILambdaContext context)
        // your lambda handler here ...

// passing handler through EpsagonHandler callback
using Epsagon.Dotnet.Lambda;

public class FunctionClass {
    public FunctionClass() {
        // initialize Epsagon agent
    // handler function
    public string MyHandler(S3Event input, ILambdaContext context) {
        // wrap entire function with EpsagonHandler.Handle()
        return EpsagonHandler.Handle<TEvent, TRes>(input, context, () => {
            // your lambda handler here ...
package main

import (

func myHandler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
  log.Println("In myHandler, received body: ", request.Body)
  return events.APIGatewayProxyResponse{Body: request.Body, StatusCode: 200}, nil

func main() {
  log.Println("enter main")

Did this page help you?