Probekit uses two sets of rules to determine whether a given method
is to be instrumented: rules specified in the target specifications part
of the probe definition, and rules specified as filters in the Profile
dialog box when you launch your application. Both target specifications and
filters affect whether a probe is applied to a given method, even if you do
not specify them explicitly.
For a probe to be applied to a given method, both sets of rules must result
in the method being marked "included."
To determine whether a set of rules includes the method, Probekit considers
each rule one by one, in the order in which you have arranged them, and checks
the package, class, and method name for the method against the patterns in
the rule. As soon as there is a match, the method is marked "included" or
"excluded," as stated in the rule. This first match determines the results
for the method; no other rules are checked. There is an implicit "include
all" rule at the end of each set, so if a set is empty, or if there is no
rule whose patterns match the method, the method is included.
To probe a specific method or set of methods, you can use target specifications,
filters, or a combination of both:
- Target specifications are appropriate for probes that are intended always
to investigate a specific method or set of methods. For information, read Probe target specifications.
- Filters are appropriate when the connection between the probe and its
targets is not so close. For information, read Collecting probe data: Basic usage.
- A combination of target specifications and filters gives you great flexibility
in applying your probes.
For example, assume that you write a probe that
is intended to gather information about servlets running on application servers.
You can use the target specifications for the probe to say that the probe
should apply only to methods called doPut:

Note that these target specifications do not limit the package or class
that the probe applies to. As a result,
the probe can collect data for every doPut method in every class
that runs.
For any given run, however, you ordinarily want to collect
data only about the doPut method in a specific class, for example,
the class myServlet. To do this, set up a filter in the Profile dialog
box when you launch the application:

With
this filter in place, plus the target rules specified in the probe itself,
the run collects information for the specific doPut method that you
want to investigate. You can reuse the probe for other doPut methods
by specifying a different class in the filter when you launch the probe.