@Retention(value=RUNTIME)
@Target(value={METHOD,FIELD,PARAMETER,ANNOTATION_TYPE})
public @interface Metric
@Inject
@Metric(name="histogram")
public Histogram histogram;
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.
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;
}
};
Modifier and Type | Optional Element and Description |
---|---|
boolean |
absolute
Denotes whether to use the absolute name or use the default given name relative to the annotated class.
|
java.lang.String |
description
The description of the metric.
|
java.lang.String |
displayName
The display name of the metric.
|
java.lang.String |
name
The name of the metric.
|
java.lang.String[] |
tags
The tags of the metric.
|
java.lang.String |
unit
The unit of the metric.
|
public abstract java.lang.String name
public abstract java.lang.String[] tags
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.Metadata
public abstract boolean absolute
true
, use the given name as an absolute name. If false
(default),
use the given name relative to the annotated class.public abstract java.lang.String displayName
Metadata
public abstract java.lang.String description
Metadata
public abstract java.lang.String unit
MetricUnits.NONE
.Metadata
,
MetricUnits