Annotation Type Metric
-
@Retention(RUNTIME) @Target({METHOD,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, Counter, and Histogram.@Inject @Metric(name="histogram") public Histogram histogram;
This may also be used to register a metric.
@Produces @Metric(name="hitPercentage") @ApplicationScoped Gauge<Double> hitPercentage = new Gauge<Double>() { @Override public Double getValue() { return hits / total; } };
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description boolean
absolute
java.lang.String
description
java.lang.String
displayName
java.lang.String
name
java.lang.String[]
tags
java.lang.String
unit
-
-
-
-
tags
java.lang.String[] tags
- Returns:
- The tags of the metric. Each
String
tag must be in the form of 'key=value'. If the input is empty or does not contain a '=' sign, the entry is ignored. - See Also:
Metadata
- Default:
- {}
-
-
-
displayName
java.lang.String displayName
- Returns:
- The display name of the metric.
- See Also:
Metadata
- Default:
- ""
-
-
-
description
java.lang.String description
- Returns:
- The description of the metric.
- See Also:
Metadata
- Default:
- ""
-
-
-
unit
java.lang.String unit
- Returns:
- The unit of the metric. By default, the value is
MetricUnits.NONE
. - See Also:
Metadata
,MetricUnits
- Default:
- "none"
-
-