Add URI template support to ProxyExchange for observability#4137
Merged
ryanjbaxter merged 1 commit intospring-cloud:4.3.xfrom Apr 9, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes missing URI template observability for MVC ProxyExchange backend calls by preserving the URI template pattern through to RestTemplate, enabling Micrometer’s http.client.requests uri tag to be populated (instead of "none").
Changes:
- Add a
ProxyExchange.uri(String uriTemplate, Map<String, ?> uriVariables)overload that stores the template + variables and expands to a concreteURI. - Update
ProxyExchange.exchange(...)to callRestTemplate.exchange(String, ...)when a template is available, preserving the URI template for observability. - Add an integration test asserting that the
http.client.requestsmetric containsuri="/foos/{id}"when using the new overload.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
spring-cloud-gateway-proxyexchange-webmvc/src/main/java/org/springframework/cloud/gateway/mvc/ProxyExchange.java |
Introduces URI-template-aware uri(...) overload and routes exchanges through RestTemplate.exchange(String, ...) to preserve template metadata for Micrometer. |
spring-cloud-gateway-proxyexchange-webmvc/src/test/java/org/springframework/cloud/gateway/mvc/ProductionConfigurationTests.java |
Adds coverage validating that URI template usage results in a templated uri tag in http.client.requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
Please sign your commit and also submit this against the 4.3.x branch |
Signed-off-by: fru1tworld <fruitworld.planet@gmail.com>
8e754d0 to
6117ec4
Compare
Contributor
Author
|
Rebased onto 4.3.x and signed the commit. Thanks for the feedback! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ProxyExchange.exchange() used rest.exchange(RequestEntity, ...) which loses
the URI template pattern, causing Micrometer http.client.requests uri tag
to always be "none".
Add uri(String, Map) overload that preserves the template so RestTemplate
can pass it to Micrometer.
Fixes #3458