All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.avaje.metrics.annotation.Timed Maven / Gradle / Ivy

The newest version!
package io.avaje.metrics.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Put onto a Class or methods that we want timed execution statistics collected.
 * 

* When put on a Class the default is that all public methods on that Class are timed. *

*

* When put on a method we want to override some of metric naming or only collect timed * execution on very few methods on the class. *

*/ @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Timed { /** * Set the prefix for short metric names. Typically used at class level to define a common short prefix * to replace the package name for the metrics on the class. *
{@code
   *
   * @Timed(perfix="web.api")
   * public class AdminResource
   *   ...
   *
   * }
*/ String prefix() default ""; /** * Set the metric name. *

* When on a class this override the default metric name which is based * on the short name of the class. *

*

* On methods we use this when the method name is not appropriate or when * there is method overloading and the otherwise generated unique name is unclear. *

*/ String name() default ""; /** * Define buckets as a list of millisecond times. *

* For example with values of 100, 200, 300 there a with 4 bucket ranges of: *

   *      0 to 100 milliseconds
   *    100 to 200 milliseconds
   *    200 to 300 milliseconds
   *    300+       milliseconds
   * 
*

* Defining buckets means a BucketTimedMetric will be used instead of a TimedMetric. */ int[] buckets() default {}; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy