On this page:

Your Rating:
1 rates

RequestStreamHandler and RequestHandler, are predefined handlers provided by AWS.

This topic discusses Serverless APM instrumentation options. 

AppDynamics provides Serverless APM functionality in the form of a tracer library. 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 tracer instrumentation, your function inherits the tracer's configurations. Your project's class becomes a subclass of MonitoredRequestStreamHandler, a wrapper class provided with the tracerAutomatic tracer instrumentation performs these actions:

  • Creates, starts, and stops a transaction 

  • Locates any correlation header 
  • Reports transaction errors

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

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 below 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 for more information.

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.

Create Exit Calls

Create an exitCall object from a transaction when your function makes a call to external resources, such as to another AWS Lambda function or an outbound HTTP call. The exitCall object records the time spent in external exit calls, which allows AppDynamics to register and display the calls on a flow map and highlight application performance issues. Additionally, the exitCall object allows you to tag and follow requests when your AWS Lambda function is upstream of other instrumented tiers. 

Backend Exit Calls

A set of identifying properties identifies a backend of any given exit type. For example, if the exit call type is HTTP, the identifying properties are the HTTP host and port. For exit calls between AWS Lambda functions, the identifying property is the name of the downstream function. You can find additional backend naming details for AppDynamics agents in Backend Detection Rules

You must map these backend identifying properties and pass them to the createExitCall method. The createExitCall method obtains an ExitCall object, which is used to time the exit. When correlation with a downstream tier occurs, you can use the ExitCall object to obtain a correlation header to write into the transmitted payload. 


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.

  • No labels