Skip to content

MVC ProxyExchange does not provide observability of URI template #3458

Open
@MGerriorBB

Description

@MGerriorBB

Describe the bug
Using Spring Cloud 2023.0.3 and Spring Boot 3.2.7, it appears that the micrometer observability for the MVC version of ProxyExchange does not properly support URI templates. Looking at actuator at /actuator/metrics/<project>.http.client.requests the URI tag is always "none". I'm not sure if it's due to use of RestTemplate directly https://github.com/spring-cloud/spring-cloud-gateway/blob/main/spring-cloud-gateway-mvc/src/main/java/org/springframework/cloud/gateway/mvc/ProxyExchange.java#L170 as opposed to RestTemplateBuilder per https://docs.spring.io/spring-framework/reference/integration/observability.html#observability.http-client.resttemplate ?

Sample
Won't be able to provide the exact code, but we use UriComponentsBuilder which may be causing issues? Something like:

        return proxyExchange.uri(
            UriComponentsBuilder.fromHttpUrl("http://service.internal.com")
                .path("/v1/documents/{documentId}")
                .build(Map.of("documentId", "<documentId from PathVariable>")
        ).get();

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions