According to the documentation of the spring boot actuator
Auto-configuration enables the instrumentation of requests handled by Spring MVC. When management.metrics.web.server.auto-time-requests is true, this instrumentation occurs for all requests. Alternatively, when set to false, you can enable instrumentation by adding @Timed
And
By default, metrics are generated with the name, http.server.requests
When I access the /metrics endpoint I am getting
{
"mem": 405105,
"mem.free": 150352,
"processors": 8,
"instance.uptime": 440055,
"uptime": 455888,
"systemload.average": 1.904296875,
"heap.committed": 315392,
"heap.init": 262144,
"heap.used": 164015,
"heap": 4194304,
"nonheap.committed": 92800,
"nonheap.init": 4992,
"nonheap.used": 89714,
"nonheap": 0,
"threads.peak": 64,
"threads.daemon": 43,
"threads.totalStarted": 95,
"threads": 46,
"classes": 12459,
"classes.loaded": 12459,
"classes.unloaded": 0,
"gc.g1_young_generation.count": 12,
"gc.g1_young_generation.time": 127,
"gc.g1_old_generation.count": 0,
"gc.g1_old_generation.time": 0,
"httpsessions.max": -1,
"httpsessions.active": 0,
"datasource.primary.active": 0,
"datasource.primary.usage": 0.0,
"gauge.response.example.users": 2.0,
"counter.status.200.example.users": 5
}
So the http.server.requests is not there. The counter.status.200.example kind of shows the requests that go through my application but they are separated per endpoint. I need an overall for the whole application.
I've tried disabling the management.metrics.web.server.auto-time-requests and adding @Timed to the endpoints, but that did not work as well. The result was the same as the one above.
Does anyone know how I can show the overall requests that are made to the application? Thank you in advance.
*EDIT
when I add
compile('io.micrometer:micrometer-registry-prometheus:latest.release')
I get the following error
Parameter 0 of method prometheusEndpointFix in PrometheusEndpointConfiguration required a bean of type 'PrometheusEndpoint' that could not be found.
Even though the @Bean is there..
@Configuration
class PrometheusEndpointConfiguration {
@Bean
public PrometheusEndpoint prometheusEndpoint() {
return new PrometheusEndpoint(CollectorRegistry.defaultRegistry);
}
...
}
One catch with it is when using the actuators and following the guide of spring boot 2.2.6 I noticed the http.server.requests will not be shown in the metrics list, if no requests have happen so far. After making the first REST request, the http metric becomes available.
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