-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)theme: observabilityAn issue related to observability and tracingAn issue related to observability and tracingtype: bugA general bugA general bug
Milestone
Description
Debugging a RestTemplate
shows that execute()
bad responses are properly throwing exceptions, which when caught, are setting the error to the observation:
response = request.execute();
observationContext.setResponse(response);
handleResponse(url, method, response);
return (responseExtractor != null ? responseExtractor.extractData(response) : null);
}
catch (IOException ex) {
ResourceAccessException accessEx = createResourceAccessException(url, method, ex);
observation.error(accessEx);
throw accessEx;
}
catch (Throwable ex) {
observation.error(ex);
throw ex;
}
Doing the same for the DefaultRestClient
retrieve
method shows that the clientRequest.execute()
call is not throwing any exception, thus no error is recorded to the observation (later during the toEntity
call the exception is thrown, but at that time the client observation is already stopped).
clientResponse = clientRequest.execute();
observationContext.setResponse(clientResponse);
ConvertibleClientHttpResponse convertibleWrapper =
new DefaultConvertibleClientHttpResponse(clientResponse);
return exchangeFunction.exchange(clientRequest, convertibleWrapper);
}
catch (IOException ex) {
ResourceAccessException resourceAccessException =
createResourceAccessException(uri, this.httpMethod, ex);
if (observation != null) {
observation.error(resourceAccessException);
}
throw resourceAccessException;
}
catch (Throwable error) {
if (observation != null) {
observation.error(error);
}
throw error;
}
What is the idea of the new RestClient implementation, how is it supposed to propagate the exception to the observation?
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)theme: observabilityAn issue related to observability and tracingAn issue related to observability and tracingtype: bugA general bugA general bug