Create External Exit Calls

The 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.

The exitCall types and identifying properties are listed below:

Exit Call Type Identifying Properties
HTTP

HOST

PORT

URL

QUERY STRING

JDBC

URL

HOST

PORT

DATABASE

VERSION

VENDOR

WEB SERVICE

SERVICE

URL

OPERATION

SOAP ACTION

VENDOR

CUSTOM Any user-defined set of properties

Create an Exit Call

Call createExitCall() on your transaction object.

The following code sample demonstrates how you might perform an external exit call:

public void makeExitCall(URL url){
 
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
 
String outgoingHeader = null;
String callType = null;
Map<String, String> identifyingProperties = new HashMap<>();
    
//Below properties are appropriate for an inter-AWS Lambda call
identifyingProperties.put("DESTINATION", functionName);
identifyingProperties.put("DESTINATION_TYPE", "LAMBDA");
callType="CUSTOM";
    
//Below properties are appropriate for an external HTTP call
identifyingProperties.put("HOST", url.getHost());     
identifyingProperties.put("PORT", String.valueOf(url.getPort()));
callType="HTTP";
 
//Define the createExitCall method to obtain an exitCall object.     
ExitCall exitCall = transaction.createExitCall(callType, identifyingProperties);
outgoingHeader =  exitCall.getCorrelationHeader();
exitCall.start();
    
try {
// Tracer.APPDYNAMICS_TRANSACTION_CORRELATION_HEADER_KEY is the name of the header that should be set
   
    if (outgoingHeader != null) {
        conn.setRequestProperty(Tracer.APPDYNAMICS_TRANSACTION_CORRELATION_HEADER_KEY, outgoingHeader); // set the correlation header on an HttpURLConnection
    }
  
// Make the exit call here
  
} finally {
        exitCall.stop();
    }
}

Making Multiple External Exit Calls

If one AWS1 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.

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.