This page applies to an earlier version of the AppDynamics App IQ Platform.
For documentation on the latest version, see the 4.4 Documentation.


On this page:

Related pages:

Your Rating:
Results:
PatheticBadOKGoodOutstanding!
53 rates

Collecting Application Data provides general information on understanding and configuring data collectors. This topic takes you through configuration examples, including how to access data or data rendering methods via the invoked object. 

Java Cart Application Example Configuration

In this example, we'll set up a data collector on a Java application, Cart. As previously mentioned, when setting up a data collector, it helps to be able to see the source code corresponding to the code on which you are setting up the data collector. You can view the complete code of the application used in the example at https://github.com/Appdynamics/ECommerce-Java.

We want to create a data collector on the method getCartTotal(), shown in this snippet of the Cart class, along with a method we'll use later as a data source, getUser().   

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;
	}
   ...
}

There are four general steps in this example configuration:

  1. Identify the class and method, getCartTotal().
  2. Configure the return value of the method as a data source.
  3. Use a getter chain to capture the user name in the transaction. 
  4. Refine the method selection configuration.   
Identify the class and method

To identify the method, use the fully qualified name of the class and getCartTotal as the method. 

Configure the return value data source

Now specify the total cart as the source of the data to collect. Choose the return value as the source. You can have the return value rendered as a string by choosingtoString() or have it rendered by a method specified by getter chain. Since the return value in our example is numeric (a double), we can use a method in the Java base packages to render the number as a long value:
 

Capture the user name on the invoked object

Say you also wanted to capture the name of the user affected. The Cart class instantiates a User object based on the following class in the same package as Cart. Notice that the User class includes a method for returning the name of the user, getCustomerName().  

package com.appdynamicspilot.model;
...
public class User implements java.io.Serializable {
    ...
	private String customerName = null;
    ...
 
	public String getCustomerName() {
		return customerName;
	}
	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}
    ...
} 

Using a getter chain, you can identify this method as another data source in the same data collector. For this case, select Invoked Object as the source of the data. The getter chain getUser().getCustomerName() the operation on the invoked object:

For an HTTP data collector, the user name is sometime available as a variable value (e.g., userid) in the HTTP query or cookie. By creating a data collector on userid, you can similarly identify affected users in transaction snapshots for slow transactions with an HTTP data collector.

Refining the method match

Getter chains on the invoked object are also available for constructing method identification filters.

For example, say you want to capture the customer name only in certain cases. Our sample application, for example, differentiates users by types, corresponding to imaginary service levels, diamond, platinum, and so on, as shown in the following snippet of the same User class: 

package com.appdynamicspilot.model;

public class User implements java.io.Serializable {
	public enum CUSTOMER_TYPE  {DIAMOND,PLATINUM,GOLD,SILVER,BRONZE};
    ...

	public CUSTOMER_TYPE getCustomerType() {
		return this.customerType;
	}
}


To capture the user name and the cart total for only gold level users, you could add a match condition that collects data from the Invoked Object and uses the following getter chain as the operation on the invoked object, using the condition Equals GOLD:

When complete, transaction snapshots for slow, very slow, and stalled transactions, the transaction snapshots will include user data that shows the user name and cart total amount for GOLD customers. 

PHP HTTP Data Collector Example Configuration

This example shows how the PHP Agent can be configured to capture information from an HTTP request.

In the HTTP Data Collector configuration specify the request data that you want to display in the snapshot.

This configuration captures two HTTP parameters, the URL and session ID, the cookie name, the session keys and the headers:

Then, in the transaction snapshots, the URL and Session ID are displayed In the SUMMARY tab, and the configured HTTP parameters, session keys and headers in the HTTP PARAMS tab, along with the request method and response code:

And the cookie name and value in the COOKIES tab:

 


 


 

 

  • No labels