Annotation Type Metric


  • @Retention(RUNTIME)
    @Target({METHOD,FIELD,PARAMETER,ANNOTATION_TYPE})
    public @interface Metric
    An annotation requesting that a metric be injected or registered.

    Given a field like this:

    
         @Metric
         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, which is useful for creating a histogram with a custom Reservoir.

    
         @Metric
         public Histogram uniformHistogram = new Histogram(new UniformReservoir());
     

    Since:
    3.1
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean absolute  
      String name  
    • Element Detail

      • name

        String name
        Returns:
        The name of the metric.
        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