Affects: Spring Framework 6.0.4
Problem
After upgrading including webflux
version 6.0.4, the URI tag from the http.client.requests
metrics are always none
when making web client calls.
After the web client is called several times, the output from the metrics/http.client.request
endpoint looks like this
Steps to reproduce
- Create a Srping Boot 3.0.2 application with reactive web.
- Add
org.springframework.boot:spring-boot-starter-actuator
andio.micrometer:micrometer-registry-prometheus
dependencies. - Create a simple get endpoint that calls a webclient and perform several get requests.
- Check the
metrics/http.client.request
endpoint, look at the uri tag that has value "none"
I created a simple demo project to reproduce the issue here.
Comment From: bclozel
The behavior changed there to only record the uri key value if a uri template is being used to avoid cardinality explosion.
Let me check with your sample.
Comment From: bclozel
I think this can be summarized with the following call:
WebClient client = WebClient.builder()
.observationRegistry(registry)
.baseUrl("https://example.org/")
.build();
String response = client.get().retrieve().bodyToMono(String.class).block();
In this case, the client call doesn't use the uri(String uri, Object... uriVariables)
method, so no URI template is being used. This behavior is consistent with the client usage. Using the following code snippet instead should make the uri tag available:
WebClient client = WebClient.builder()
.observationRegistry(registry)
.baseUrl("https://example.org")
.build();
String response = client.get().uri("/").retrieve().bodyToMono(String.class).block();
Requiring developers to switch to this variant for this case doesn't make sense, so we should add a special case for "/"
templates and record them as KeyValue
no matter how they were produced.