A target specification indicates the classes and methods to which the probe should be applied.
The target specification is optional. When no target is specified, the probe will be applied to all classes that are processed by the instrumentation engine.
The target specification 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 "*" matches 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* matches 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. (The signature is the string representing the method's arguments and return type.) Use 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:
To specify a target, select Target in the tree pane of the Probes page, and click Add, then Edit in the editing pane.
This example applies the probe only to methods whose names start with Get in classes whose names end with Proxy in the package com.example. Target entries of types include and exclude; the exclude target entry uses asterisk wildcards to exclude everything; the include entry specifies the exact methods to be targeted. All other classes and methods are excluded from instrumentation.