If RestTemplate
is created with a RestTemplateBuilder
with a root URI configured, the URI tag of the http.client.requests
metric will not include the root.
Comment From: wilkinsona
Here's a possible fix. Flagging for team attention as the change makes RootUriTemplateHandler'
s use of the delegate pattern apparent from its public API and I'd like to check that we're all happy with that.
Comment From: philwebb
I don't think it's a big problem to expose the fact that RootUriTemplateHandler
uses a delegate, the constructor already implies as much.
I do wonder if we should make the RootUriTemplateHandler
responsible for creating a new instance of itself. The fact it calls a bunch of getters then uses the constructor again might be a bit brittle. Perhaps something like this would be better?:
if (delegate instanceof RootUriTemplateHandler) {
return ((RootUriTemplateHandler) delegate).withHandlerWrapper(CapturingUriTemplateHandler::new);
}
The withHandlerWrapper
would take a Function<UriTemplateHandler,UriTemplateHandler>
.
Comment From: wilkinsona
I like that. Thanks, @philwebb.