Spring Webflux - Actuator - Netty thread metrics?

Viewed 2830

Small question regarding Netty metrics for a Spring Webflux + actuator project please.

In the Spring MVC world, combined with actuator, we have metrics such as:

tomcat_threads_busy_threads
tomcat_threads_current_threads
tomcat_threads_config_max_threads

jetty_threads_busy
jetty_threads_current
jetty_threads_config_max

Which helps a lot to get the overall status of the application.

However, in Webflux, it seems there is no equivalent.

I was expecting something like netty_threads_busy or something equivalent, but could not find anything related.

May I ask what would be the equivalent in Netty Webflux world please?

Thank you

1 Answers

The metrics expose by reactor-netty are not enabled by default in spring boot. There was a previous discussion on this github issue and the decision was not to enable these by default.

If you wanted to enable the netty server metrics in your own application, you can add the following bean to customise the Netty HttpServer.

    @Bean
    public NettyServerCustomizer nettyServerCustomizer(){
        return httpServer -> httpServer.metrics(true, uriMappingFunction);
    }

Caveat:

If you have path parameters in any of your URIs you should provide a uriMappingFunction that converts them to templated URIs ie. /user/1 -> /user/{id}. Failure to do so could lead to cardinality explosion in your MeterRegistry.

Enabling this feature also comes with the following recommendation:

It is strongly recommended applications to configure an upper limit for the number of the URI tags.

Reference Documentation

Java Doc

Related