diff --git a/zuul-core/src/main/java/com/netflix/zuul/context/CommonContextKeys.java b/zuul-core/src/main/java/com/netflix/zuul/context/CommonContextKeys.java index a79ead3ced..60567e0fac 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/context/CommonContextKeys.java +++ b/zuul-core/src/main/java/com/netflix/zuul/context/CommonContextKeys.java @@ -22,6 +22,7 @@ import com.netflix.zuul.message.http.HttpResponseMessage; import com.netflix.zuul.niws.RequestAttempts; import com.netflix.zuul.stats.status.StatusCategory; +import io.netty.channel.Channel; import java.net.InetAddress; import java.util.Map; @@ -48,8 +49,7 @@ public class CommonContextKeys { SessionContext.newKey("_zuul_endpoint"); public static final SessionContext.Key> ZUUL_ORIGIN_CHOSEN_HOST_ADDR_MAP_KEY = SessionContext.newKey("_zuul_origin_chosen_host_addr_map"); - public static final String ZUUL_ORIGIN_REQUEST_URI = "_zuul_origin_request_uri"; - public static final String ORIGIN_CHANNEL = "_origin_channel"; + public static final SessionContext.Key ORIGIN_CHANNEL = SessionContext.newKey("_origin_channel"); public static final String ORIGIN_MANAGER = "origin_manager"; public static final String ROUTING_LOG = "routing_log"; public static final String USE_FULL_VIP_NAME = "use_full_vip_name"; diff --git a/zuul-core/src/main/java/com/netflix/zuul/filters/endpoint/ProxyEndpoint.java b/zuul-core/src/main/java/com/netflix/zuul/filters/endpoint/ProxyEndpoint.java index 83515baba8..d87016dd19 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/filters/endpoint/ProxyEndpoint.java +++ b/zuul-core/src/main/java/com/netflix/zuul/filters/endpoint/ProxyEndpoint.java @@ -122,6 +122,7 @@ public class ProxyEndpoint extends SyncZuulFilterAdapter implements GenericFutureListener> { private static final String ZUUL_ORIGIN_ATTEMPT_IPADDR_MAP_KEY = "_zuul_origin_attempt_ipaddr_map"; + private static final String ZUUL_ORIGIN_REQUEST_URI = "_zuul_origin_request_uri"; private final ChannelHandlerContext channelCtx; private final FilterRunner responseFilters; @@ -397,7 +398,7 @@ private void storeAndLogOriginRequestInfo() { context.put(CommonContextKeys.ZUUL_ORIGIN_CHOSEN_HOST_ADDR_MAP_KEY, attemptToChosenHostMap); } - eventProps.put(CommonContextKeys.ZUUL_ORIGIN_REQUEST_URI, zuulRequest.getPathAndQuery()); + eventProps.put(ZUUL_ORIGIN_REQUEST_URI, zuulRequest.getPathAndQuery()); } protected void updateOriginRpsTrackers(NettyOrigin origin, int attempt) { @@ -562,7 +563,7 @@ private void writeClientRequestToOrigin(final PooledConnection conn, Duration re // set read timeout on origin channel ch.attr(ClientTimeoutHandler.ORIGIN_RESPONSE_READ_TIMEOUT).set(readTimeout); - context.set(ORIGIN_CHANNEL, ch); + context.put(ORIGIN_CHANNEL, ch); context.set(POOLED_ORIGIN_CONNECTION_KEY, conn); preWriteToOrigin(chosenServer.get(), zuulRequest);