Annotation Type CachedGauge


@Retention(RUNTIME) @Target({METHOD,ANNOTATION_TYPE}) public @interface CachedGauge
An annotation for marking a method as a gauge, which caches the result for a specified time.

Given a method like this:


     @CachedGauge(name = "queueSize", timeout = 30, timeoutUnit = TimeUnit.SECONDS)
     public int getQueueSize() {
         return queue.getSize();
     }

 

A gauge for the defining class with the name queueSize will be created which uses the annotated method's return value as its value, and which caches the result for 30 seconds.

Since:
3.1
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    long
     
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
     
     
     
  • Element Details

    • timeout

      long timeout
      Returns:
      The amount of time to cache the result
    • name

      String name
      Returns:
      The name of the counter.
      Default:
      ""
    • absolute

      boolean absolute
      Returns:
      If true, use the given name as an absolute name. If false, use the given name relative to the annotated class.
      Default:
      false
    • timeoutUnit

      TimeUnit timeoutUnit
      Returns:
      The unit of timeout
      Default:
      MILLISECONDS