Description
After upgrading to Spring Boot 3, we are seeing http.client.requests
metrics with uri
tags containing the scheme, host and port. This is a deviation from Spring Boot 2 and is causing problems with metric publication.
In Spring Boot 2.7, http.client.requests
uri tag values were stripped of the scheme, host and port. See the discussion in this issue and the associated fix to align WebClient and RestTemplate uri tags. This test class shows a stripped URI tag value when using a full URI as the template.
Calling RestTemplate like this:
restTemplate.exchange("http://cis-public-api.cis.ident.service/v4/init?key={devKey}", HttpMethod.GET, ...);
yields uri
tags in the Spring Boot 3.0.2 actuator/metrics/http.client.requests
endpoint looking like this:
{
"tag": "uri",
"values": [
"http://cis-public-api.cis.ident.service/v4/init?key={devKey}",
]
}
Results in Spring Boot 2.7 making the same call:
{
"tag": "uri",
"values": [
"/v4/init?key={devKey}",
]
}
Observation: In Spring Boot 3, when setting a baseUrl in RestTemplate and using /v4/init?key={devKey}
as the uriTemplate in the exchange call, the uri tag value looks the same as it did in Spring Boot 2.7.
As a side note, but related to this change, we use the Datadog StatsD flavor to publish metrics to Splunk. These full URI tag values no longer show up in Splunk metrics, but uri tag values without the scheme, host and port are showing up as expected.
I have verified the uri tag values are included in statsd line data for both scenarios, so somehow, the extra characters are causing problems (perhaps the extra :
between the scheme and host, since the StatsD line format uses colons as delimiters).