Polish Observability instrumentation
This commit removes the scoping of `RestTemplate` requests, since no user code is meant to run during HTTP client exchanges. This also polishes the reactive `WebFilter` to directly use the specific enum when creating the observation.
This commit is contained in:
@@ -849,9 +849,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
if (requestCallback != null) {
|
||||
requestCallback.doWithRequest(request);
|
||||
}
|
||||
try (Observation.Scope scope = observation.openScope()) {
|
||||
response = request.execute();
|
||||
}
|
||||
response = request.execute();
|
||||
observationContext.setResponse(response);
|
||||
handleResponse(url, method, response);
|
||||
return (responseExtractor != null ? responseExtractor.extractData(response) : null);
|
||||
|
||||
@@ -97,8 +97,8 @@ public class HttpRequestsObservationWebFilter implements WebFilter {
|
||||
}
|
||||
|
||||
private Publisher<Void> filter(ServerWebExchange exchange, HttpRequestsObservationContext observationContext, Mono<Void> call) {
|
||||
Observation observation = Observation.createNotStarted(this.observationConvention, DEFAULT_OBSERVATION_CONVENTION,
|
||||
observationContext, this.observationRegistry);
|
||||
Observation observation = HttpRequestsObservation.HTTP_REQUESTS.createNotStarted(this.observationConvention,
|
||||
DEFAULT_OBSERVATION_CONVENTION, () -> observationContext, this.observationRegistry);
|
||||
observation.start();
|
||||
return call.doOnEach(signal -> {
|
||||
Throwable throwable = signal.getThrowable();
|
||||
|
||||
Reference in New Issue
Block a user