Instrumentation Options

You can instrument the tracer:

  • Automatically, using Splunk AppDynamics class MonitoredRequestStreamHandler or
  • Manually, using Splunk 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 AWS1 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.

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.