Package io.prometheus.client.spring.web
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 aSummarywith a name specified by the requirednameparameter, and help specified by thehelpparameter. To properly work,EnablePrometheusTimingmust 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