Annotation Type Telemetry
-
@Retention(RUNTIME) @Target(METHOD) public @interface TelemetryCreate a custom telemetry from the numeric return value of the annotated static method in your subclasses ofPayloadProbeorSplitProbe.Only public static parameterless methods can be used for creating custom telemetries, annotating instance methods or non-public static methods will not have any effect. The method must return a numeric value, either a primitive value like
intordouble, ajava.math.BigDecimalor a primitive wrapper instance likejava.lang.Integerorjava.lang.Double.The method is called periodically on a dedicated thread. This may have implications for the requirements of thread safety in your code. If the numeric value is calculated on the fly, access to the data structures must by made thread-safe by making access to those data structures synchronized. Alternatively, you could calculate a cached value when convenient and save it to a volatile atomic value, like an
intor a class from thejava.util.concurrent.atomicpackage.For example, the following code snippet defines a custom telemetry with the name "Connection count":
@Telemetry("Connection count") public static int getConnectionCount() { return connectionCount; }Multiple lines in a single custom telemetry
If you want to compare several measurements in the same telemetry, you can annotate multiple methods with the same
value()for the telemetry name, but with a differentline()parameter.For example:
@Telemetry(value = "Queries", line = "Successful queries") public static int getSuccessCount() { return successCount; } @Telemetry(value = "Queries", line = "Failed queries") public static int getErrorCount() { return errorCount; }This will create a single custom telemetry with the name "Queries" and two data lines named "Successful queries" and "Failed queries".
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description java.lang.StringvalueThe name of the telemetry.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description TelemetryFormatformatOptional display options for the telemetry.java.lang.StringlineThe optional line name of the telemetry.
-
-
-
Element Detail
-
value
java.lang.String value
The name of the telemetry. Give different names to different telemetries. Reuse the same name when annotating different methods if you are creating a custom telemetry with multiple lines. If only a single line is used, you can omit the "value" parameter name, as in@Telemetry("Connection count")
-
-
-
line
java.lang.String line
The optional line name of the telemetry. Only specify this parameter if you're creating a telemetry with multiple lines. SeeTelemetryfor an example.- Default:
- ""
-
-
-
format
TelemetryFormat format
Optional display options for the telemetry.- Default:
- @com.jprofiler.api.probe.embedded.telemetry.TelemetryFormat
-
-