-
Notifications
You must be signed in to change notification settings - Fork 705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URI_TEMPLATE_ATTRIBUTE used when available with feature flag. Fixes g… #1328
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,17 +25,21 @@ | |
import org.springframework.cloud.client.loadbalancer.RequestDataContext; | ||
import org.springframework.cloud.client.loadbalancer.ResponseData; | ||
import org.springframework.util.StringUtils; | ||
import org.springframework.web.reactive.function.client.WebClient; | ||
|
||
/** | ||
* Utility class for building metrics tags for load-balanced calls. | ||
* | ||
* @author Olga Maciaszek-Sharma | ||
* @author Jaroslaw Dembek | ||
* @since 3.0.0 | ||
*/ | ||
final class LoadBalancerTags { | ||
|
||
static final String UNKNOWN = "UNKNOWN"; | ||
|
||
static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Load-balanced requests can come from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spring-projects/spring-framework#31882 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since for a given client the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what you mean by " We have integration tests that verify that
|
||
|
||
private LoadBalancerTags() { | ||
throw new UnsupportedOperationException("Cannot instantiate utility class"); | ||
} | ||
|
@@ -70,6 +74,12 @@ private static int statusValue(ResponseData responseData) { | |
} | ||
|
||
private static String getPath(RequestData requestData) { | ||
if (requestData.getAttributes() != null) { | ||
var uriTemplate = (String) requestData.getAttributes().get(URI_TEMPLATE_ATTRIBUTE); | ||
if (uriTemplate != null) { | ||
return uriTemplate; | ||
} | ||
} | ||
return requestData.getUrl() != null ? requestData.getUrl().getPath() : UNKNOWN; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the license comment to
Copyright 2012-2024
in all the files you've changed.