简体   繁体   中英

Spring Webflux application, unable to get reactor.netty.http.client* metrics and reactor.netty.connection.provider* metrics

Small question regarding metrics with a Spring Webflux 2.4.2 application.

The application is a server, and during processing, uses the Webflux Webclient in order to perform outbound HTTP requests.

Now, I am looking at this page here: https://projectreactor.io/docs/netty/release/reference/index.html#_metrics_5

Mainly, I can see those kinds of metrics:

1 - the reactor.netty.http.client.data* metrics

2 - the reactor.netty.connection.provider* metrics

3 - the reactor.netty.bytebuf.allocator.used* metrics

I am only able to get the third group, the reactor.netty.bytebuf.allocator.used* metrics.

How to, what configurations are needed to get the first two types please?

I am already doing:

  @Bean
    public NettyServerCustomizer nettyServerCustomizer() {
        return httpServer -> httpServer.metrics(true, () -> new MicrometerChannelMetricsRecorder("myService", "myService"));
    }

and this in my main method Schedulers.enableMetrics();

I am really wondering how to get the first two types, please.

Thank you

The first metric in your list are metrics published by the client and the second is published by the connection provider. Neither are related to the HttpServer. As a result, you need to enable these metrics in your Tcp/HttpClient/ConnectionProvider. This is exposed in a similar way to the HttpServer.

HttpClient Example

HttpClient.create().metrics(true, uriTagValueFunction)

TcpClient Example

TcpClient.create().metrics(true)

Connection Provider Example

ConnectionProvider.builder(poolName).metrics(true).build()

HttpClient JavaDocs

TcpClient JavaDocs

ConnectionProvider JavaDocs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM