Annotation Type Metric
-
@Retention(RUNTIME) @Target({FIELD,PARAMETER,ANNOTATION_TYPE}) public @interface Metric
An annotation requesting that a metric be injected or registered. The metric will be registered in the application MetricRegistry. Given an injected field annotated with @Metric like this:
A meter of the field's type will be created and injected into managed objects. It will be up to the user to interact with the metric. This annotation can be used on fields of type Meter, Timer, SimpleTimer, Counter, and Histogram.@Inject @Metric(name="histogram") public Histogram histogram;This may also be used to register a metric.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description booleanabsoluteDenotes whether to use the absolute name or use the default given name relative to the annotated class.StringdescriptionThe description of the metric.StringnameThe name of the metric.StringscopeThe scope that this metric belongs to.String[]tagsThe tags of the metric.StringunitThe unit of the metric.
-
-
-
Element Detail
-
name
String name
The name of the metric.- Returns:
- The name of the metric.
- Default:
- ""
-
-
-
unit
String unit
The unit of the metric.- Returns:
- The unit of the metric. By default, the value is
MetricUnits.NONE. - See Also:
Metadata,MetricUnits
- Default:
- "none"
-
-
-
scope
String scope
The scope that this metric belongs to.- Returns:
- The scope this metric belongs to. By default, the value is
MetricRegistry.APPLICATION_SCOPE.
- Default:
- "application"
-
-