Use zone id as dimension when getting flag
@@ -11,7 +11,8 @@ import com.yahoo.restapi.Path;
import com.yahoo.restapi.SlimeJsonResponse;
import com.yahoo.slime.Cursor;
import com.yahoo.slime.Slime;
-import com.yahoo.vespa.flags.BooleanFlag;
+import com.yahoo.vespa.flags.FetchVector;
+import com.yahoo.vespa.flags.FlagSource;
import com.yahoo.vespa.flags.Flags;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.api.integration.ServiceRegistry;
@@ -35,14 +36,14 @@ public class ZoneApiHandler extends AuditLoggingRequestHandler {
private final ZoneRegistry zoneRegistry;
private final ConfigServerRestExecutor proxy;
- private final BooleanFlag useConfigServerVip;
+ private final FlagSource flagSource;
public ZoneApiHandler(LoggingRequestHandler.Context parentCtx, ServiceRegistry serviceRegistry,
ConfigServerRestExecutor proxy, Controller controller) {
super(parentCtx, controller.auditLogger());
this.zoneRegistry = serviceRegistry.zoneRegistry();
this.proxy = proxy;
- this.useConfigServerVip = Flags.USE_CONFIG_SERVER_VIP.bindTo(controller.flagSource());
+ this.flagSource = controller.flagSource();
}
@Override
@@ -112,8 +113,11 @@ public class ZoneApiHandler extends AuditLoggingRequestHandler {
}
private ProxyRequest proxyRequest(ZoneId zoneId, String path, HttpRequest request) {
+ boolean useConfigServerVip = Flags.USE_CONFIG_SERVER_VIP.bindTo(flagSource)
+ .with(FetchVector.Dimension.ZONE_ID, zoneId.value()).value();
+
// TODO: Still need to hardcode AWS since flag cannot be set until flag has been rolled out
- if (zoneId.region().value().startsWith("aws-") || useConfigServerVip.value()) {
+ if (zoneId.region().value().startsWith("aws-") || useConfigServerVip) {
return ProxyRequest.tryOne(zoneRegistry.getConfigServerVipUri(zoneId), path, request);
}
return ProxyRequest.tryAll(zoneRegistry.getConfigServerUris(zoneId), path, request);
