Follow up on #22371
Version: Spring Webflux 7.0.8
Using URI wrapper on WebClient drops uri tag in metrics.
@SpringBootTest
class UriMetricsTest(
@param:Autowired private val builder: WebClient.Builder,
@param:Autowired private val meterRegistry: MeterRegistry,
) {
@Test
fun `uri via string`() {
runCatching {
builder
.build()
.get().uri("http://localhost:8080/foo")
.retrieve()
.bodyToMono<String>()
.block()
}
Thread.sleep(1000)
val timer = meterRegistry["http.client.requests"].timer()
assert(timer.id.tags.contains(Tag.of("uri", "/foo"))) { "${timer.id.tags}" } // passes
}
@Test
fun `uri via url`() {
runCatching {
builder
.build()
.get().uri(URI("http://localhost:8080/bar"))
.retrieve()
.bodyToMono<String>()
.block()
}
Thread.sleep(1000)
val timer = meterRegistry["http.client.requests"].timer()
assert(timer.id.tags.contains(Tag.of("uri", "/bar"))) { "${timer.id.tags}" } // fails
}
}
Follow up on #22371
Version: Spring Webflux 7.0.8
Using
URIwrapper onWebClientdropsuritag in metrics.