Method Invocation Data Collector Example
Method invocation data collectors are applicable to Java and .NET.
In this example of a manual setup (not using the wizard), we'll set up a method invocation data collector on a Java application. We want to create a data collector on the method getCartTotal(), which is shown in this code snippet with the method getUser() and which we will use later as a data source.
package com.appdynamicspilot.model;
...
public class Cart implements java.io.Serializable {
...
private Double fakeAmount = 0.0;
...
private User user;
...
public User getUser() {
return user;
}
...
public Double getCartTotal() {
if (fakeAmount == 0.0) {
double total = 0;
if (items != null) {
for (Item item : items) {
total += item.getPrice();
}
}
return total;
} return fakeAmount;
}
...
}
To configure a data collector for an application, add a data collector and then configure it:
When complete, transaction snapshots for slow, very slow, and stalled transactions, the transaction snapshots will include the specified user data.