Package com.codahale.metrics.annotation
Annotation Type ExceptionMetered
-
@Retention(RUNTIME) @Target(METHOD) public @interface ExceptionMeteredAn annotation for marking a method of an annotated object as metered. Given a method like this:
A meter for the defining class with the name@ExceptionMetered(name = "fancyName", cause=IllegalArgumentException.class) public String fancyName(String name) { return "Sir Captain " + name; }fancyNamewill be created and each time the#fancyName(String)throws an exception of typecause(or a subclass), the meter will be marked. A name for the metric can be specified as an annotation parameter, otherwise, the metric will be named based on the method name. For instance, given a declaration of
A meter named@ExceptionMetered public String fancyName(String name) { return "Sir Captain " + name; }fancyName.exceptionswill be created and marked every time an exception is thrown.
-
-
Field Summary
Fields Modifier and Type Fields Description static java.lang.StringDEFAULT_NAME_SUFFIXThe default suffix for meter names.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description booleanabsoluteIftrue, use the given name as an absolute name.java.lang.Class<? extends java.lang.Throwable>causeThe type of exceptions that the meter will catch and count.java.lang.StringnameThe name of the meter.
-