in zuul-core/src/main/java/com/netflix/zuul/niws/RequestAttempt.java [62:114]
public RequestAttempt(
int attemptNumber,
InstanceInfo server,
InetAddress serverAddr,
String targetVip,
String chosenWarmupLB,
int status,
String error,
String exceptionType,
int readTimeout,
int connectTimeout,
int maxRetries) {
if (attemptNumber < 1) {
throw new IllegalArgumentException("Attempt number must be greater than 0! - " + attemptNumber);
}
this.attempt = attemptNumber;
this.vip = targetVip;
if (server != null) {
this.app = server.getAppName().toLowerCase(Locale.ROOT);
this.asg = server.getASGName();
this.instanceId = server.getInstanceId();
this.host = server.getHostName();
this.port = server.getPort();
// If targetVip is null, then try to use the actual server's vip.
if (targetVip == null) {
this.vip = server.getVIPAddress();
}
if (server.getDataCenterInfo() instanceof AmazonInfo) {
this.availabilityZone =
((AmazonInfo) server.getDataCenterInfo()).getMetadata().get("availability-zone");
// HACK - get region by just removing the last char from zone.
String az = getAvailabilityZone();
if (az != null && az.length() > 0) {
this.region = az.substring(0, az.length() - 1);
}
}
}
if (serverAddr != null) {
ipAddress = serverAddr.getHostAddress();
}
this.status = status;
this.error = error;
this.exceptionType = exceptionType;
this.readTimeout = readTimeout;
this.connectTimeout = connectTimeout;
this.maxRetries = maxRetries;
}