|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2023 the original author or authors. |
|
|
|
|
* Copyright 2002-2024 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -367,6 +367,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
@@ -367,6 +367,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
|
|
|
|
this.observationConvention = observationConvention; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GET
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -847,13 +848,14 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
@@ -847,13 +848,14 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
|
|
|
|
request = createRequest(url, method); |
|
|
|
|
} |
|
|
|
|
catch (IOException ex) { |
|
|
|
|
ResourceAccessException exception = createResourceAccessException(url, method, ex); |
|
|
|
|
throw exception; |
|
|
|
|
throw createResourceAccessException(url, method, ex); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ClientRequestObservationContext observationContext = new ClientRequestObservationContext(request); |
|
|
|
|
observationContext.setUriTemplate(uriTemplate); |
|
|
|
|
Observation observation = ClientHttpObservationDocumentation.HTTP_CLIENT_EXCHANGES.observation(this.observationConvention, |
|
|
|
|
DEFAULT_OBSERVATION_CONVENTION, () -> observationContext, this.observationRegistry).start(); |
|
|
|
|
Observation observation = ClientHttpObservationDocumentation.HTTP_CLIENT_EXCHANGES.observation( |
|
|
|
|
this.observationConvention, DEFAULT_OBSERVATION_CONVENTION, |
|
|
|
|
() -> observationContext, this.observationRegistry).start(); |
|
|
|
|
ClientHttpResponse response = null; |
|
|
|
|
try (Observation.Scope scope = observation.openScope()){ |
|
|
|
|
if (requestCallback != null) { |
|
|
|
|
@ -865,13 +867,13 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
@@ -865,13 +867,13 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
|
|
|
|
return (responseExtractor != null ? responseExtractor.extractData(response) : null); |
|
|
|
|
} |
|
|
|
|
catch (IOException ex) { |
|
|
|
|
ResourceAccessException exception = createResourceAccessException(url, method, ex); |
|
|
|
|
observation.error(exception); |
|
|
|
|
throw exception; |
|
|
|
|
ResourceAccessException accessEx = createResourceAccessException(url, method, ex); |
|
|
|
|
observation.error(accessEx); |
|
|
|
|
throw accessEx; |
|
|
|
|
} |
|
|
|
|
catch (Throwable exc) { |
|
|
|
|
observation.error(exc); |
|
|
|
|
throw exc; |
|
|
|
|
catch (Throwable ex) { |
|
|
|
|
observation.error(ex); |
|
|
|
|
throw ex; |
|
|
|
|
} |
|
|
|
|
finally { |
|
|
|
|
if (response != null) { |
|
|
|
|
|