Instructions for installing the Lumigo tracer in a AWS Lambda function using a Python runtime

The lumigo_tracer package is Lumigo's Python agent for distributed tracing and performance monitoring on AWS Lambda. It allows you to pursue automated metric gathering through Lambda Layers, automated metric gathering and instrumentation.


Add the Lumigo Tracer to your application

To begin, add the following line to your requirements.txt file:


Next, open your Lambda function code. Import the lumigo tracer so that it may be used locally:

from lumigo_tracer import lumigo_tracer

Once you've imported the tracer, add the lumigo_tracer decorator to your Lambda function's handler.

def my_lambda(event, context):
    print('I can view this line now')

Once these two steps have been completed, your code should resemble the following example:

import json
from lumigo_tracer import lumigo_tracer
def lambda_handler(event, context):
  return {
    'statusCode': 200,
    'body': json.dumps('Hi!')

Connect Your Lumigo Account

Set your Lumigo token as the LUMIGO_TRACER_TOKEN environment variable of your Lambda function; refer to the Using AWS Lambda environment variables documentation for more information. Your Lumigo token is available in Settings -> Tracing -> Manual tracing.

We advise you to use the most secure available to you to store secrets such as your LUMIGO_TRACER_TOKEN; additionally, AWS provides integrations for AWS Key Management Service that keep the values of your Lambda environment variables secure.


Using Lambda Layers?

You can find our Python Lambda Layer here.

Learn more about Lambda Layers


Using Step Functions?

Monitor your step functions by adding the flag step_function=True to your @lumigo_tracer decorator.

Learn more about our step function support on our GitHub repository

Library support



Supported versions








Do you need Lumigo to support a different package?

If Lumigo does not yet support a package you use, please contact our support.

Did this page help you?