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 name, class name, method name, and method signature. The patterns can contain wildcards, where "*" matches zero or more characters.
If a rule's wildcard patterns match a method's package name, class name, method name, and method signature, the Target Type property determines whether the method is instrumented (include) or not (exclude). If the patterns do not match a method's package name, class name, method name, and method signature, the next rule is examined. At the end of the list of rules, there is an implicit "include all" rule, so that any method that has not been explicitly excluded is instrumented.
Property | Description |
---|---|
Target Type | Required. The Target Type property determines whether a probe is applied to a target method. Select Include to apply the probe to classes and methods that match the wildcard patterns, or Exclude to exclude classes and methods that match those patterns. |
Package name pattern | 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 *. |
Class name pattern | Optional. Specify a wildcard pattern to match against class names. If not specified, the default value is *. |
Method name pattern | Optional. Specify a wildcard pattern to match against method names. If not specified, the default value is *. |
Method signature pattern | Optional. Specify a wildcard pattern to match against the signature for a method. (The signature is the string representing the arguments and return type for the method.) 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 the list of target rules for a probe, 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. All other classes and methods are excluded from instrumentation.