1
1
/*
2
- * Copyright 2002-2023 the original author or authors.
2
+ * Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -367,6 +367,7 @@ public void setObservationConvention(ClientRequestObservationConvention observat
367
367
this .observationConvention = observationConvention ;
368
368
}
369
369
370
+
370
371
// GET
371
372
372
373
@ Override
@@ -847,13 +848,14 @@ protected <T> T doExecute(URI url, @Nullable String uriTemplate, @Nullable HttpM
847
848
request = createRequest (url , method );
848
849
}
849
850
catch (IOException ex ) {
850
- ResourceAccessException exception = createResourceAccessException (url , method , ex );
851
- throw exception ;
851
+ throw createResourceAccessException (url , method , ex );
852
852
}
853
+
853
854
ClientRequestObservationContext observationContext = new ClientRequestObservationContext (request );
854
855
observationContext .setUriTemplate (uriTemplate );
855
- Observation observation = ClientHttpObservationDocumentation .HTTP_CLIENT_EXCHANGES .observation (this .observationConvention ,
856
- DEFAULT_OBSERVATION_CONVENTION , () -> observationContext , this .observationRegistry ).start ();
856
+ Observation observation = ClientHttpObservationDocumentation .HTTP_CLIENT_EXCHANGES .observation (
857
+ this .observationConvention , DEFAULT_OBSERVATION_CONVENTION ,
858
+ () -> observationContext , this .observationRegistry ).start ();
857
859
ClientHttpResponse response = null ;
858
860
try (Observation .Scope scope = observation .openScope ()){
859
861
if (requestCallback != null ) {
@@ -865,13 +867,13 @@ protected <T> T doExecute(URI url, @Nullable String uriTemplate, @Nullable HttpM
865
867
return (responseExtractor != null ? responseExtractor .extractData (response ) : null );
866
868
}
867
869
catch (IOException ex ) {
868
- ResourceAccessException exception = createResourceAccessException (url , method , ex );
869
- observation .error (exception );
870
- throw exception ;
870
+ ResourceAccessException accessEx = createResourceAccessException (url , method , ex );
871
+ observation .error (accessEx );
872
+ throw accessEx ;
871
873
}
872
- catch (Throwable exc ) {
873
- observation .error (exc );
874
- throw exc ;
874
+ catch (Throwable ex ) {
875
+ observation .error (ex );
876
+ throw ex ;
875
877
}
876
878
finally {
877
879
if (response != null ) {
0 commit comments