AppDynamics Application Intelligence Platform

3.8.x Documentation

PDFs

Videos

Release Notes

Using a Java Method to Name a Transaction

You can use a Java method to name the transaction where:

  • You might not have a clear URI pattern or
  • You are using  XML/JSON frameworks that are currently not supported by AppDynamics.

The following illustration shows how the Servlet that invokes the POJO method holds the transaction name.

For example, consider the processOrder() method. The order is parsed using any type of method and eventually when the processOrder() method is invoked, a correct approach to name transaction is to capture the first parameter to the processOrder() method.

The following URL is used by these requests: http://acmeonline.com/store. Following code snippet shows the doPost() method of the Servlet:

public void doPost(HttpServletRequest req, HttpServletResponse resp)

{

//process the data from the sevlet request and get the orderType and the items
processOrder(orderType,item)
.....
}
public void processOrder(String orderType,String item)
{
//process order
}

The processOrder() method has the information which can correctly derive the type of the order and also the name of the transaction. To identify these requests as a single transaction, configure a custom match rule.

To configure the custom match rule

1. Go to the custom rule section for Servlet Entry Points

2. In the Transaction Match Criteria tab, specify the URI.

3. In the Split Transactions Using Payload tab, enable Split transactions using XML/JSON Payload or a Java method invocation.

4. Select POJO Method Call as the split mechanism .

5. Enter the class and the method name.

6. If the method is overloaded, also specify the details for the arguments. 

7. Optionally, you can name your transactions by defining multiple methods in a getter chain in the Method Call Chain field.

The following screenshot displays the configuration of a custom match rule which will name all the qualifying requests into a "Store.order.creditcard" transaction:

This custom rule ensures that the processOrder method is automatically intercepted.

Although the name is not obtained till the processOrder() method is called, the time for the transaction will include all of the doGet() method.

In addition to the parameter, you can also specify either the return type or a recursive getter chain on the object  to name the transaction. For example, if the method parameter points to a complex object like PurchaseOrder, you can use something like getOrderDetails().getType() to correctly name the transaction.

Learn More