You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve "active" metrics handling in WebClient observations
Prior to this commit, the WebClient observations would have a specific
lifecycle where the observation context is build with a
`ClientRequest.Builder` as tracing needs to add an outgoing request
header before the request is made immutable.
With this setup, the metrics observation handler processes the start
event by increasing the "http.client.requests.active" counter and
collecting tags at this point. Because then the immutable request is not
yet fully built or set on the context, the keyvalues collected by the
observation convention at that point can be incomplete.
This commit ensures that a request is always made available in the
context, even if it is updated right after the observation start. The
only difference between the two should be additional tracing headers and
a request attribute holding the current observation context.
Closesgh-31702
Copy file name to clipboardExpand all lines: spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientRequestObservationContext.java
+15Lines changed: 15 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -50,10 +50,25 @@ public class ClientRequestObservationContext extends RequestReplySenderContext<C
50
50
privateClientRequestrequest;
51
51
52
52
53
+
/**
54
+
* Create a new Observation context for HTTP client observations.
55
+
* @deprecated as of 6.1, in favor of {@link #ClientRequestObservationContext(ClientRequest.Builder)}
Copy file name to clipboardExpand all lines: spring-webflux/src/test/java/org/springframework/web/reactive/function/client/DefaultClientRequestObservationConventionTests.java
0 commit comments