The injected probe API replaces the old custom probe API. You can use it to write probes for
3rd party components. Injected probes are configured with annotations, each interception is defined by
an annotated method in the probe class. Both payload interceptions like SQL strings of the JDBC probe
or call tree splitting interceptions like URLs of the servlet probe are supported.
An injected probe can be as simple as
@Probe(name = "My probe")
public class MyProbe {
@PayloadInterception(invokeOn = InvocationType.ENTER,
method = @MethodSpec(className = "x.y.z", methodName = "importantMethod",
parameterTypes = {"java.lang.String"}, returnType = "void"))
public static String measure(@Parameter(0) String payload) {
return payload;
}
}
Examples of injected probes are available in the "api/samples" directory. "simple-injected-probe" shows
how to get started and "advanced-injected-probe" showcases other features of the API.
Embedded probes are intended to add probes to your own code. The probe is set up by deriving a
configuration class that also serves as a probe ID. Instead of having to define intercepted
methods, you then call the embedded probe API directly:
String payload = ...;
// for adding payloads like SQL strings of the JDBC probe
Payload.execute(MyProbe.class, payload, () -> {
// perform work and measure the execution times
});
// for splitting the call tree like URLs of the servlet probe
Split.execute(MyProbe.class, payload, () -> {
// perform work
});
An embedded probe is part of your software and automatically appears in JProfiler without any additional
configuration if a JVM is profiled and the probe class is loaded. Calling the embedded probe API
adds next to no overhead in production because its method bodies are empty and are only wired up to actual
code if the profiling agent is present.
Like for the injected probes, there is a "simple-embedded-probe" example for getting started and an
"advanced-embedded-probe" example for a broader look at the features of the API.
The new documentation has chapters for both injected and embedded probe APIs, and the Javadoc contains
detailed information for all features. The probe API artifacts are available as Maven dependencies
and are licensed under the Apache 2.0 license.