@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;
}
};
public abstract String name
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 String unit
MetricUnits.NONE
.Metadata
,
MetricUnits
Copyright © 2019. All rights reserved.