AppDynamics switched from Semantic Versioning to Calendar Versioning starting in February 2020 for some agents and March 2020 for the entire product suite.

    Skip to end of metadata
    Go to start of metadata

    This page describes how to use the Python Serverless Tracer with AWS Lambda functions. 

    Before You Begin

    Ensure that your setup meets the following requirements:

    • Existing AWS Lambda functions implemented in Python version 3.6 or later
    • Python Package Installer (pip version must match the Python version of your AWS Lambda function)
    • AppDynamics SaaS Controller version 4.5.16 or later

    Install the Python Serverless Tracer

    The Python Serverless Tracer is available for Python version 3.6 and later. 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 the following lines of code:

    import appdynamics # Add 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.

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

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

    • No labels