The Target probe object is a specification of the classes and methods to which the probe should be applied.
The Target object is optional. When no Target is specified, the probe will be applied to all classes that are processed by the instrumentation engine.
The Target object lets you create filter rules to include or exclude methods from instrumentation based upon patterns that are matched against the package, class, and method name, plus the method's signature. The patterns can contain wildcards, where "*" will match zero or more characters.
If a Target's wildcard patterns match a method's package, class, name and signature, the type property determines whether the method is instrumented (include) or not (exclude). If the patterns do not match a method's package, class, name and signature, by default, the method is instrumented.
Property | Description |
---|---|
type | Required. The type property determines whether or not a probe is applied to a target method. Specify include to apply the probe to classes and methods that match the wildcard patterns, exclude to exclude them. |
package | Optional. Specify a wildcard pattern to match against the package portion of class names. For example: java.util* will match every class in the java.util package and its subpackages. If not specified, the default value is *. |
className | Optional. Specify a wildcard pattern to match against class names. If not specified, the default value is *. |
method | Optional. Specify a wildcard pattern to match against method names. If not specified, the default value is *. |
signature | Optional. Specify a wildcard pattern to match against a method's signature - that is, the string representing the method's arguments and return type. This is in the Java internal format for method signatures. For example: (Ljava/lang/Object;)D is the signature of a method that takes an Object as a parameter and returns a double. This wildcard pattern can be used to distinguish among overloaded methods. If not specified, the default value is *. |
Notes:
<target type="include" package="." class="SomeClass" method="*" /> <target type="exclude" package="*" class="*" method="*" />These two target rules cause the probe to target the class SomeClass in the global package, while excluding all other classes. By these rules, a class called SomeClass that is in any other package is excluded.
<target type="include" package="com.example" className="*Proxy" method="Get*" />
Contained by
The Probe object
Parent topic: Probekit Reference