I'm working with Spring Boot, and I want to annotate some of my @Service
methods with @Timed
so I could view their statistics calling the metrics endpoint.
I've read from the Spring documentation that is can use dropwizard registry, but I can't find any example in which it uses dropwizar annotations.
How can I configure my Spring Boot app so each method annotated with @Timed
automatically publishes its statistics using the build-in Spring actuator module?
Adding @Timed to the controller creates a Timer time series named http_server_requests which by default contains dimensions for the HTTP status of the response, HTTP method, exception type if the request fails, and the pre-variable substitution parameterized endpoint URI.
* @ExceptionMetered - As the name indicates, this will create a Meter of the unhandled Exceptions thrown out of this method. This is SUPER useful for tracking error rates, and can be used together with @Timed or @Metered annotations, or entirely by itself.
Micrometer provides a simple facade over the instrumentation clients for a number of popular monitoring systems. Currently, it supports the following monitoring systems: Atlas, Datadog, Graphite, Ganglia, Influx, JMX, and Prometheus.
Spring Boot provides a metrics endpoint that can be used diagnostically to examine the metrics collected by an application. The endpoint is not available by default and must be exposed, see exposing endpoints for more details. Navigating to /actuator/metrics displays a list of available meter names.
Have you had a look at: http://www.ryantenney.com/metrics-spring/
Seems that you need to include that library if you want to use Spring with Metrics 3.0 / 3.1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With