With Spring Boot 2.0.0.M6 and the new actuator metrics endpoint, when I request
GET /application/metrics
the only the names of the metrics are shown
{
"names" : [ "data.source.active.connections", "jvm.buffer.memory.used", "jvm.memory.used", "jvm.buffer.count", "logback.events", "process.uptime", "jvm.memory.committed", "data.source.max.connections", "http.server.requests", "system.load.average.1m", "jvm.buffer.total.capacity", "jvm.memory.max", "process.start.time", "cpu", "data.source.min.connections" ]
}
Clearly I can access a specific metric using
GET /application/metrics/jvm.memory.used
But is there a way to see all metrics with one request?
Spring Boot 2 autoconfigures quite a few metrics for you, including: Uptime: report a gauge for uptime and a fixed gauge representing the application’s absolute start time Many of these metrics existed in a form in Spring Boot 1, but have been enriched with greater detail and tags in Spring Boot 2. Which monitoring systems does Micrometer support?
Think of it like SLF4J, but for metrics! Micrometer is the metrics collection facility included in Spring Boot 2’s Actuator. It has also been backported to Spring Boot 1.5, 1.4, and 1.3 with the addition of another dependency. Micrometer adds richer meter primitives to the counters and gauges that existed in Spring Boot 1.
“Application” refers to the logical group of Spring Boot microservices rather than any specific application. Click on console-availability to see everything about your application at a glance. You can look at information for either module: client or service. Click Jump To to navigate to a particular set of graphs.
This will allow Micrometer to add a timer to custom methods. Register the bean to your @SpringBootApplication or @Configuration class: Then, find the method that you want to time, and add the @Timed annotation to it. Use the value attribute to give the metric a name.
That's how the metrics
endpoint behaves in the Spring Boot 2.0.0M* releases. There are only two read operations defined in the endpoint class:
ListNamesResponse listNames()
GET /application/metrics
MetricResponse metric(@Selector String requiredMetricName,
@Nullable List<String> tag)
GET /application/metrics/jvm.memory.used
Metrics support has changed quite dramatically in 2.x (now backed by Micrometer) and the Spring Boot 2.x upgrade guide is lacking any details on metrics at the moment but it's a work in progress, so presumably more details will arive as Spring Boot 2.0 gets closer to a GA release.
I suspect the move from hierarchical metrics to dimensional metrics resulted in the maintainers deeming the 1.x (hierarchical) metrics display to be no longer viable/suitable.
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