Skip to content

Client request observation contributes full URI template to uri meter tag values #29885

Closed
@edwardsre

Description

@edwardsre

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).

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)theme: observabilityAn issue related to observability and tracingtype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions