Annotation 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:
@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, SimpleTimer, Counter, and Histogram.
This may also be used to register a metric.
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionboolean
Denotes whether to use the absolute name or use the default given name relative to the annotated class.The description of the metric.The name of the metric.The scope that this metric belongs to.String[]
The tags of the metric.The unit of the metric.
-
Element Details
-
name
String nameThe name of the metric.- Returns:
- The name of the metric.
- Default:
- ""
-
tags
String[] tagsThe tags of the metric.- 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:
- Default:
- {}
-
absolute
boolean absoluteDenotes whether to use the absolute name or use the default given name relative to the annotated class.- Returns:
- If
true
, use the given name as an absolute name. Iffalse
(default), use the given name relative to the annotated class.
- Default:
- false
-
description
String descriptionThe description of the metric.- Returns:
- The description of the metric.
- See Also:
- Default:
- ""
-
unit
String unitThe unit of the metric.- Returns:
- The unit of the metric. By default, the value is
MetricUnits.NONE
. - See Also:
- Default:
- "none"
-
scope
String scopeThe scope that this metric belongs to.- Returns:
- The scope this metric belongs to. By default, the value is
MetricRegistry.APPLICATION_SCOPE
.
- Default:
- "application"
-