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!
55 rates

Getter chains provide basic programmatic functions to let you access application data for use in data collector and business transaction configuration. This topic describes the getter chain syntax for the .NET Agent and provides examples to help you get started.

Configurations that support getter chains include:

(info) If a getter chain calls a heavy processing method, such as one that makes numerous SQL calls, the getter chain may degrade performance for both the application and the .NET Agent. When possible, use getter chains only with simple Get() methods.

For example, a simple getter that returns a property for a class, such as MyUser.Name:

public class MyUser
{
   private String Name {get; set;}
   private String Url;
   public GetUrl() {
      return this.Url;
   }
}

Special Characters in Getter Chains

The following special characters are used as separators:

  • parentheses () for enclosing parameters
  • comma , for separating parameters
  • forward slash / for separating a type declaration from a value in a parameter
  • dot . for separating the methods and properties in the getter chain

Getter chains also treat spaces at the beginning or end of a string as special characters.

If the getter chain should treat a special character literally, escape it using a backslash: \For parentheses, you only need to escape the closing parenthesis in a string.

Declare Parameter Types

The .NET Agent identifies parameter types as follows:

  • Dictionaries, anything with property accessors, use a normal parameter set, which defaults to string.
  • Arrays use single integers as parameters.

Therefore 0 means string/0 if you have a hash, or anything that translates to get_Item (any kind of property). 0 means int/0 if you have an array.

When your getter chain uses a method with parameters other than the default type, you need to declare the parameter type.

  • The following example demonstrates how to declare the parameter types to resolve the overloaded Susbstring() method. The forward slash serves as the type separator.

    GetAddress(appdynamics, sf).Substring(int/0, int/10)
    

    For instance, if GetAddress(appdynamics, sf) returns "303 2nd St, San Francisco, CA 94107", the full getter chain expression returns "303 2nd St".

  • The following example shows how to declare the parameter types for a user-defined method that takes a float parameter, a boolean parameter, and an integer parameter. The forward slash serves as the type separator.

    GetAddress(appdynamics, sf).MyMethod(float/0\.2, boolean/true, boolean/false, int/5)

Escape a Character

When you want to use one of the reserved separator characters as part of a string, you must escape the character.

  • The following example shows the how to escape the dot in the string parameter. 

    GetAddress().GetParam(a\.b\.c\.)

    The agent executes GetParam("a.b.c.") on the result of GetAddress() and returns the value of of the parameter.

  • In the following example, the first dot is part of the string method parameter, which requires an escape character. The second and third dots don't require an escape character because they are used as method separators.

    GetUser(suze\.smith).GetGroup().GetId()
  • The following example shows how to escape the closing parenthesis in a search for "()" within a string.

    GetString.Find((\))

Access Indexed Properties and Dictionary Values

If your getter chain accesses a dictionary object, you can access the values using the following syntax:

  • The following example returns the value for the key "suze.smith".

    UserDictionary.[string/suze\.smith]
  • The following example returns the value for the key "suze.smith" using the implied getter.

    UserDictionary.get_Item(suze\.smith)

Split a Character Array

If you want to access the various segments of a URL, you will need to treat it as a character array:

  • The following example splits a URL on the forward slash character. In this case the first slash acts as a type separator. The getter chain returns the fourth item in the array.

    GetUrl().Split(char[]//).[3]

    The agent returns "Search" when it applies the getter chain to the following URL: http://howdyworld.example.com/Search/Airfare

  • The following example splits on the forward slash character, then returns the length property of the resulting array.

    GetUrl().Split(char[]//).Length
  • The following example illustrates a transaction splitting rule for URIs that use a semicolon delimiter. The getter chain splits on the forward slash, then splits the fourth element on the semicolon.

    GetUri().Split(char[]//).[3].Split(char[]/;).[0]

    The agent returns "create-user" when it applies the getter chain to the following URL:

     http://HowdyWorld.example.com/create-user;sessionid=BE7F31CC0235C796BF8C6DF3766A1D00?act=Add&uid=c42ab7ad-48a7-4353-bb11-0dfeabb798b5 


Compose Getter Chains for HttpRequest Objects

The .NET Agent requires special syntax for getter chains on System.Web.HttpRequest objects in ASP.NET WebForms, MVC, and MVC WebAPI applications.

  • Use the following syntax to delineate the boundaries of the getter chain:

    ${myobject.myproperty}
  • The following example determines the user principal:

    ${Context.User.Identity.Name}

Places to use this syntax include:

  • HTTP Request Data Collectors
  • ASP.NET Transaction Detection custom expressions