From 199a6756926ba94561e6070a4a3d27881a18af82 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 24 Jan 2024 12:35:30 +0100 Subject: [PATCH] Declare current observation context as available since 6.0.15 See gh-31609 See gh-31646 --- .../ClientRequestObservationContext.java | 24 +++++----- .../ClientRequestObservationContext.java | 45 ++++++++++--------- 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/http/client/observation/ClientRequestObservationContext.java b/spring-web/src/main/java/org/springframework/http/client/observation/ClientRequestObservationContext.java index 43a056e2a72b..a150dc8d9555 100644 --- a/spring-web/src/main/java/org/springframework/http/client/observation/ClientRequestObservationContext.java +++ b/spring-web/src/main/java/org/springframework/http/client/observation/ClientRequestObservationContext.java @@ -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. @@ -23,10 +23,12 @@ import org.springframework.lang.Nullable; /** - * Context that holds information for metadata collection - * during the {@link ClientHttpObservationDocumentation#HTTP_CLIENT_EXCHANGES client HTTP exchanges} observations. + * Context that holds information for metadata collection during the + * {@link ClientHttpObservationDocumentation#HTTP_CLIENT_EXCHANGES client HTTP exchanges} observations. + * *

This context also extends {@link RequestReplySenderContext} for propagating tracing * information with the HTTP client exchange. + * * @author Brian Clozel * @since 6.0 */ @@ -35,6 +37,7 @@ public class ClientRequestObservationContext extends RequestReplySenderContextThe {@link #getCarrier() tracing context carrier} is a {@link ClientRequest.Builder request builder}, - * since the actual request is immutable. For {@code KeyValue} extraction, the {@link #getRequest() actual request} - * should be used instead. + * since the actual request is immutable. For {@code KeyValue} extraction, + * the {@link #getRequest() actual request} should be used instead. * * @author Brian Clozel * @since 6.0 @@ -37,10 +38,11 @@ public class ClientRequestObservationContext extends RequestReplySenderContext findCurrent(ClientRequest request) { return Optional.ofNullable((ClientRequestObservationContext) request.attributes().get(CURRENT_OBSERVATION_CONTEXT_ATTRIBUTE)); } + }