This page describes requirements, download instructions, and an instrumentation overview for the Java Serverless Tracer. 

Before You Begin

Ensure that your setup meets these requirements:

  • Existing AWS Lambda functions implemented in Java
  • Active Serverless APM for AWS Lambda subscription
  • AppDynamics SaaS Controller >= 4.5.11 

Instrumentation Overview

Instrumentation of Serverless APM for AWS Lambda consists of three steps:

  1. Declare a Dependency on the Java Serverless Tracer
  2. Choose an Instrumentation Method
    1. Automatic Tracer Instrumentation
    2. Manual Tracer Instrumentation
  3. Verify the Serverless Tracer instrumentation 

Declare a Dependency on the Java Serverless Tracer

AppDynamics provides Serverless APM functionality in the form of a tracer library. 

Express your project's dependency on the Java Serverless Tracer using Apache Maven or Gradle as follows: 

dependencies {
    compile group: 'com.appdynamics', name: 'lambda-tracer', version: '20.03.1391'

If you do not use Apache Maven or Gradle, contact AppDynamics to obtain the Serverless Tracer JAR file

Instrumentation Options

You can instrument the tracer:

  • Automatically, using AppDynamics class MonitoredRequestStreamHandler, or 

  • Manually, using AppDynamics method AppDynamics.getTracer(context)

Automatic Tracer Instrumentation

You can automatically instrument the tracer if your function uses the RequestStreamHandler interface. 

In automatic instrumentation, your function inherits the tracer's configurations. Automatic instrumentation preconfigures the tracer to:

  • Create, start, and stop a transaction 

  • Locate any correlation header 
  • Report transaction errors

RequestStreamHandler and RequestHandler are predefined handlers provided by AWS. See AWS documentation.

Manual Tracer Instrumentation

In manual tracer instrumentation, the method AppDynamics.getTracer(context) instantiates the tracer at the beginning of your function's entry point method. Manually instrument the tracer if:

  • Your AWS Lambda function does not implement the RequestStreamHandler interface. 

  • You do not want your function to inherit configurations from the MonitoredRequestStreamHandler.
  • Your AWS Lambda functions are multi-threaded, to ensure that behavior is defined. See Synchronize the Tracer for more details.   

Manual tracer instrumentation requires you to perform these actions:

  • Instantiate the tracer
  • Create, start, and stop a transaction 
  • Locate a correlation header 
  • Report transaction errors

The AWS Lambda context object in Java, context, is provided by AWS. See AWS documentation.

Synchronize the Tracer 

For both instrumentation options, you should synchronize any access to the tracer. 

In automatic instrumentation, you need to synchronize the transaction object returned by the getTransaction() method.  

In manual instrumentation, you need to synchronize the tracer object returned by the getTracer() method. Manual tracer instrumentation is required for multi-threaded use of the tracer.

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.