Annotation Interface Gauge
An annotation for marking a method or field as a gauge. The metric will be registered in the application
MetricRegistry.
Given a method annotated with @Gauge like this:
@Gauge(name = "queueSize")
public int getQueueSize() {
return queue.size;
}
A gauge with the fully qualified class name + queueSize
will be created which uses the annotated method's
return value as its value.
The annotated method/field must be of numeric type (extends Number
).-
Required Element Summary
-
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 gauge.The name of the gauge.The scope that this gauge belongs to.String[]
The tags of the gauge.
-
Element Details
-
unit
String unitThe unit of the gauge.- Returns:
- (Required) The unit of the gauge.
- See Also:
-
-
-
name
String nameThe name of the gauge.- Returns:
- The name of the gauge.
- Default:
- ""
-
tags
String[] tagsThe tags of the gauge.- Returns:
- The tags of the gauge. 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 gauge.- Returns:
- The description of the gauge.
- See Also:
- Default:
- ""
-
scope
String scopeThe scope that this gauge belongs to.- Returns:
- The scope this gauge belongs to. By default, the value is
MetricRegistry.APPLICATION_SCOPE
.
- Default:
- "application"
-