Automatic tracer instrumentation consists of the following steps:
- Instantiate the Tracer
- (Optional) Override Correlation Header Method
- Obtain a Transaction Object
- Create External Exit Calls
Instantiate the Java Serverless Tracer
Automatic instantiation is compatible with
RequestStreamHandler interfaces. All other interfaces require manual instantiation.
RequestStreamHandler is a predefined handler provided by AWS. See AWS documentation for more information.
To automatically instantiate the tracer:
- Make your current handler class extend AppDynamics
- Rename your handler class's existing method
(Optional) Override Correlation Header Method
Automatic instrumentation uses the
MonitoredRequestStreamHandler class, which provides default logic to find a correlation header.
If you need to use a custom transport mechanism for your correlation header, you must override the tracer’s default logic in the
getCorrelationHeader() method. Insert your custom logic to find the inbound correlation header so the tracer can return the inbound header.
The code snippet demonstrates how to override the
Obtain a Transaction Object
MonitoredRequestStreamHandler class creates a transaction for you automatically. However, you need to obtain the
transaction object for use with exit calls.
The code snippet below demonstrates how to obtain the
Create External Exit Calls
createExitCall method is used to obtain an
exitCall object. Exit call objects record the time spent in external exit calls and allow for correlation of downstream activity.
Exit Call Types and Identifying Properties
In the Controller, each exit call has a distinct type, determined by a set of identifying properties.
exitCall types and identifying properties are listed below:
|CUSTOM||Any user-defined set of properties|
Create an Exit Call
createExitCall() on your
The following code sample demonstrates how you might perform an external exit call:
Making Multiple External Exit Calls
If one AWS Lambda function makes multiple exit calls, each function should be identified by a unique
exitCall object. To make multiple exit calls, create new
exitCall objects for each distinct exit call. The
exitCall objects are not reusable.
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.