Annotation Type PrometheusTimeMethod


  • @Retention(RUNTIME)
    @Target(METHOD)
    public @interface PrometheusTimeMethod
    Enable Spring-AOP-based automated method timing for the annotated method. The timings will be recorded in a Summary with a name specified by the required name parameter, and help specified by the help parameter. To properly work, EnablePrometheusTiming must be specified somewhere in your application configuration.
    
     @Controller
      public class MyController {
        @RequestMapping("/")
        @ResponseBody
        @PrometheusTimeMethod(name = "my_method_seconds", help = "The number of seconds taken by the main handler")
        public Object handleRequest() {
          // Each invocation will be timed and recorded.
          return database.withCache().get("some_data");
        }
      }
     
    Author:
    Andrew Stuart
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      String help
      The help message to show in prometheus metrics
      String name
      The metric name to use for recording latencies
    • Element Detail

      • name

        String name
        The metric name to use for recording latencies
        Returns:
        A metric name specific to your use case.
      • help

        String help
        The help message to show in prometheus metrics
        Returns:
        A help string