Default Spring Boot metrics

By default, the Spring Boot actuator configures Micrometer to gather the most commonly used metrics such as the process uptime, CPU usage, memory usage by regions, GC pauses, treads count, loaded classes, and the number of open file descriptors. It also tracks Logback logger events as counters. All of this behavior is defined by an actuator's MetricsAutoConfiguration and gives a pretty evident picture regarding the service metrics.

For reactive applications, an actuator provides WebFluxMetricsAutoConfiguration, which adds a specialized WebFilter. This filter adds callbacks to the ServerWebExchange to intersect the moment when the request processing is finished. It is possible to report the request time. In addition, in the metric's report that filter includes information such as the request URI, HTTP method, response status, and exception type (if any) in the form of tags. In this way, reactive processing of an HTTP request can be easily metered with the Micrometer library. Metrics results are reported with a metric called http.server.requests.

Similarly, a Spring Boot actuator instruments RestTemplate and registers the  http.client.requests metric to report on outgoing requests. Starting with Spring Boot 2.1, an actuator does the same with the WebClient.Builder bean. Nevertheless, even for Spring Boot 2.0, it is still easy to add the desired metrics for WebClient related workflows. Such an approach is explained in the following section.

Along with other useful things, a Spring Boot actuator makes it possible to add common tags to all Meters of the application. This is especially handy in multi-node service deployment, as it allows us to clearly distinguish service nodes by tags. For this purpose, an application should register a bean that implements the MeterRegistryCustomizer interface.

To read more about customizations that the Spring Boot actuator enables over the Micrometer library, please read the following article: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#production-ready-metrics-getting-started.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.184.200