@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 |
java.lang.String |
description |
java.lang.String |
displayName |
java.lang.String |
name |
java.lang.String[] |
tags |
java.lang.String |
unit |
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