Cloud, Product

Step-by-Step Guide: Enhancing Lambda Performance Monitoring with AppDynamics

By | | 4 min read


Summary
Serverless computing simplifies IT operations by delegating infrastructure setup, configuration, provisioning, and management to a cloud vendor.

Today, around 20% of enterprises are utilizing functions as a service (FaaS), the most well-known manifestation of serverless computing. And Gartner estimates that number will grow to 50% by 2025. With the elasticity and flexibility offered by FaaS, it’s no wonder that AWS Lambda has seen explosive growth since its launch in 2014.

And if you’re using Lambda functions written in NodeJS and/or Python, Lambda monitoring is about to get a lot easier.

For those who are unfamiliar, AWS Lambda is an event-driven, serverless computing platform that runs code in response to events and automatically manages the computing resources required by that code. The increase in Lambda adoption has brought a corresponding surge in demand for solutions that measure the application code running inside these serverless environments.

That’s why, starting today, AppDynamics has taken advantage of Amazon’s public preview release of their new AWS Lambda Runtime Extensions API to offer a Lambda extension for NodeJS and Python to handle the automatic setup of instrumentation for your Lambda functions.

What Does the AppD Lambda Extension Mean for You?

AppDynamics is an AWS Lambda Ready solution for monitoring of AWS Lambda functions written in Java, NodeJS, and Python, designed to provide our customers with comprehensive visibility into how Lambda functions are performing within their application’s ecosystem.

Previously, providing this visibility came with a bit of a time investment. With the AppDynamics Tracer SDK, implementing monitoring of Lambda functions required modifying the code of the Lambda function to enable monitoring. This required coordination with development teams which added additional overhead in putting instrumentation in place.

 

appdynamics lambda extension

 

Now, by leveraging our AWS Lambda extension to handle the automatic setup of instrumentation, DevOps and developer teams can spend less time on the mundane task of writing code to set up instrumentation, and more time innovating and optimizing their business-critical applications. Including Lambda functions in the application monitoring landscape allows customers to measure and baseline performance of those functions in the context of the application and alert when performance deviates from normal.

What’s Supported?

Support for automatic instrumentations is available for Lambda functions written in the following languages:

  • NodeJS 10.x and later
  • Python 3.6 and later

 

How to Set Up

appdynamics lambda environment

 

Prerequisites for Lambda monitoring with AppDynamics are outlined in the documentation, along with required environment variables to facilitate communication to the AppDynamics controller. To take advantage of automatic instrumentation for a Lambda function, two additional steps are required:

  1. Add an environment variable to the Lambda function.
  2. Update the Lambda function with our Lambda extension.

 

For functions written in NodeJS versions 10.x and above, or in Python version 3.8, add the following environment variable to the Lambda function to activate the Lambda extension:

AWS_LAMBDA_EXEC_WRAPPER=/opt/appdynamics-extension-script

For functions written in Python versions 3.6 or 3.7, use the following environment variable:

APPDYNAMICS_PYTHON_AUTOINSTRUMENT=true

Our Lambda extension is published as a Lambda layer. The method for attaching the Lambda layer will vary based on how the Lambda function is deployed. Examples of how to attach a Lambda layer are available for the Serverless framework, AWS CLI, AWS SAM, and AWS CloudFormation. The screenshot at the top of this section is using the Serverless framework.

The ARN to use for the Lambda extension layer is:

arn:aws:lambda:us-west-2:716333212585:layer:appdynamics-lambda-extension:9

Note that the AWS region of the ARN will depend on the region where you’re running the Lambda function, and the region of the Lambda extension layer ARN must match the region where the function is running.

Auto-instrumentation of Lambda functions via the Lambda extension is available in the following AWS regions:

eu-central-1ap-northeast-1ca-central-1
eu-north-1ap-northeast-2sa-east-1
eu-west-1ap-south-1us-east-1
eu-west-2ap-southeast-1us-east-2
eu-west-3ap-southeast-2us-west-1
us-west-2

Additional Notes

If there are exit calls that are not detected out-of-the-box by our agents for NodeJS or Python, those will continue to be added into the code of the Lambda function. Also, Lambda functions written in Java still require the tracer SDK to be packaged with the function. Examples of how to add in exit calls for Python are available in this blog, and code examples for all languages are available on GitHub.

If you’ve already implemented AppDynamics Lambda instrumentation by embedding the tracer SDK, nothing changes for you. Lambda monitoring will continue to work as normal.

Conclusion

AppDynamics has an AWS Lambda Ready designation for providing a validated low-effort integration for monitoring AWS Lambda functions, and now AppDynamics has made it even easier to instrument Python and NodeJS Lambda functions. As a result, developers and DevOps organizations can concentrate on the things that matter most for their business.

If you have questions or feedback, reach out to me on Twitter at @thewaynebrown. You can also connect with me on LinkedIn.

Interested in trying out AppDynamics? Sign up for a free trial here. Finally, learn more about AppDynamics Serverless APM for Lambda in the AWS Marketplace.