Python Serverless Tracer

This page provides requirements and an overview of the instrumentation process for Python functions during development. The preferred method is to use the Splunk AppDynamics AWS1 Lambda Extension. See Use the Splunk AppDynamics AWS Lambda Extension to Instrument Serverless APM at Runtime.

Note: This document contains links to Amazon Web Services (AWS) documentation. Splunk AppDynamics makes no representation as to the accuracy of Amazon documentation because Amazon controls its own documentation.

Before You Begin

Ensure that your setup meets the following requirements:

  • Existing AWS Lambda functions implemented in Python 3.7, 3.8, and 3.9
  • Python Package Installer (the pip version must match the Python version of your AWS Lambda function)
  • Splunk AppDynamics SaaS Controller >= 4.5.16

Install the Python Serverless Tracer

Note: The Python Serverless Tracer is available for Python 3.7, 3.8, and 3.9. The version of the tracer you obtain from PyPi needs to match the version of Python you use to run your function code in AWS.

The Python Serverless Tracer is available for download in PyPi repository. You can install the Python Serverless Tracer locally or package it with your AWS Lambda function code.

Install Locally

Run a pip install command to install the tracer in your local environment:

pip install appdynamics-lambda-tracer

If you install the tracer locally, you need to package the tracer with your AWS Lambda function at runtime.

Package with AWS Lambda Functions

Run the following command to include the tracer in your function's package:

pip install --target ./package/ appdynamics-lambda-tracer

See AWS documentation to learn more about packaging dependencies in your functions.

Instrument Your Function Code

To instrument your AWS Lambda function, add these lines of code:

import appdynamics # Add Splunk AppDynamics libraries. Must be the first line of code
@appdynamics.tracer # Must come before the handler function
def my_handler(event, context):
print("Hello world!")

Exit Call Instrumentation

By default, the Python Serverless Tracer automatically discovers HTTP, Amazon DynamoDB, and inter-AWS Lambda exit calls. Use the Python Tracer API to create an exit call if you want visibility into other types of external calls made by your function. See Python Serverless Tracer API.

Note: This document contains links to AWS documentation. Splunk AppDynamics makes no representation as to the accuracy of Amazon documentation because Amazon controls its own documentation.

Python Serverless Tracer API

This page describes how to use the Python Serverless Tracer API to modify the behavior of the tracer within your AWS Lambda function.

Integrate the Python Tracer with End User Monitoring

Serverless APM for AWS Lambda is designed to integrate with your existing End User Monitoring (EUM) configurations. EUM integration provides complete end-to-end visibility on the performance of your web and mobile applications, linking calls from an end-user device through your serverless functions to continue your business transactions

AWS Lambda functions can correlate EUM and AWS Lambda-originated business transactions, in conjunction with the following EUM agents:

Note: This document assumes you are familiar with Splunk AppDynamicsEnd User Monitoring. See

End User Monitoring

.
1 Amazon Web Services, the AWS logo, AWS, and any other AWS Marks used in these materials are trademarks of Amazon.com, Inc. or its affiliates in the United States and/or other countries.