Matching by Class and Method

You can specify matching criteria for the custom rule based on various forms of a method or class to which the method belongs.

When specifying the method name matching criteria, use parameter matching to match against a particular method signature. For example, say you want to instrument one of more methods in the following class:

class A
{
public void m1();
public void m1(String a);
public void m1(String a, com.mycompany.MyObject b);
}

Configure instrumentation for each method based on its signature as follows:

  • To instrument the first method signature (with no parameters), create a POJO-based business transaction match rule as follows:
    • Match Classes: with a Class Name that Equals A
    • Method Name: Equals m1()
  • To instrument the second method, create a match rule as follows:
    • Match Classes: with a Class Name that Equals A
    • Method Name: Equals m1(java.lang.String)
  • To instrument the third method, create a match rule as follows:
    • Match Classes: with a Class Name that Equals A
    • Method Name: Equals m1(java.lang.String, com.mycompany.MyObject)

You can also match methods that belong to classes with certain annotations. For example, to match all classes that are annotated with @it.sauronsoftware.cron4j.Task, the custom rule configuration can be defined as:

Rule editor

When calls to the process() method match, the result is a business transaction named for the custom match rule name.