Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: move ZUUL_ORIGIN_REQUEST_URI and ORIGIN_CHANNEL to be type safe #1091

Merged
merged 1 commit into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -48,8 +49,7 @@ public class CommonContextKeys {
SessionContext.newKey("_zuul_endpoint");
public static final SessionContext.Key<Map<Integer, InetAddress>> 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<Channel> 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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
public class ProxyEndpoint extends SyncZuulFilterAdapter<HttpRequestMessage, HttpResponseMessage> implements GenericFutureListener<Future<PooledConnection>> {

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<HttpResponseMessage, ?> responseFilters;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down