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.

Given a field annotated with @Gauge like this:


     @Gauge
     long value;
 
A gauge with the fully qualified class name + value will be created which uses the annotated field value as its value.
  • Element Details

    • name

      String name
      Returns:
      The name of the gauge.
      Default:
      ""
    • tags

      String[] tags
      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 absolute
      Returns:
      If true, use the given name as an absolute name. If false (default), use the given name relative to the annotated class.
      Default:
      false
    • displayName

      String displayName
      Returns:
      The display name of the gauge.
      See Also:
      Default:
      ""
    • description

      String description
      Returns:
      The description of the gauge.
      See Also:
      Default:
      ""