PatPanda
PatPanda

Reputation: 5012

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.

Upvotes: 0

Views: 3229

Answers (1)

Michael McFadyen
Michael McFadyen

Reputation: 2977

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

Upvotes: 1

Related Questions