summaryrefslogtreecommitdiffstats
path: root/service-monitor/src/main
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@oath.com>2017-10-02 20:22:33 +0200
committerHåkon Hallingstad <hakon@oath.com>2017-10-02 20:22:33 +0200
commit3237d9de41b1dd0094fe081faf7b5ef0741ffff9 (patch)
treea27fd4a1bb135f708cc32bd1737f5eea16c9224d /service-monitor/src/main
parent61679bfc56d0f9c5df09e92b70375ec1262179f0 (diff)
ServiceMonitor v2 support for single tenancy
Diffstat (limited to 'service-monitor/src/main')
-rw-r--r--service-monitor/src/main/java/com/yahoo/vespa/service/monitor/ModelGenerator.java15
-rw-r--r--service-monitor/src/main/java/com/yahoo/vespa/service/monitor/ServiceMonitorImpl.java15
2 files changed, 23 insertions, 7 deletions
diff --git a/service-monitor/src/main/java/com/yahoo/vespa/service/monitor/ModelGenerator.java b/service-monitor/src/main/java/com/yahoo/vespa/service/monitor/ModelGenerator.java
index ef418f99d47..bee34524b20 100644
--- a/service-monitor/src/main/java/com/yahoo/vespa/service/monitor/ModelGenerator.java
+++ b/service-monitor/src/main/java/com/yahoo/vespa/service/monitor/ModelGenerator.java
@@ -31,6 +31,11 @@ import java.util.stream.Collectors;
public class ModelGenerator {
public static final String CLUSTER_ID_PROPERTY_NAME = "clustername";
+ /**
+ * Create service model based primarily on super model.
+ *
+ * If the configServerhosts is non-empty, a config server application is added.
+ */
ServiceModel toServiceModel(
SuperModel superModel,
Zone zone,
@@ -47,10 +52,12 @@ public class ModelGenerator {
}
// The config server is part of the service model (but not super model)
- ConfigServerApplication configServerApplication = new ConfigServerApplication();
- ApplicationInstance<ServiceMonitorStatus> configServerApplicationInstance =
- configServerApplication.toApplicationInstance(configServerHosts);
- applicationInstances.put(configServerApplicationInstance.reference(), configServerApplicationInstance);
+ if (!configServerHosts.isEmpty()) {
+ ConfigServerApplication configServerApplication = new ConfigServerApplication();
+ ApplicationInstance<ServiceMonitorStatus> configServerApplicationInstance =
+ configServerApplication.toApplicationInstance(configServerHosts);
+ applicationInstances.put(configServerApplicationInstance.reference(), configServerApplicationInstance);
+ }
return new ServiceModel(applicationInstances);
}
diff --git a/service-monitor/src/main/java/com/yahoo/vespa/service/monitor/ServiceMonitorImpl.java b/service-monitor/src/main/java/com/yahoo/vespa/service/monitor/ServiceMonitorImpl.java
index 3468644169d..c3ce129e89a 100644
--- a/service-monitor/src/main/java/com/yahoo/vespa/service/monitor/ServiceMonitorImpl.java
+++ b/service-monitor/src/main/java/com/yahoo/vespa/service/monitor/ServiceMonitorImpl.java
@@ -8,6 +8,7 @@ import com.yahoo.config.provision.Zone;
import com.yahoo.vespa.applicationmodel.ApplicationInstance;
import com.yahoo.vespa.applicationmodel.ApplicationInstanceReference;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
@@ -26,12 +27,20 @@ public class ServiceMonitorImpl implements ServiceMonitor {
public ServiceMonitorImpl(SuperModelProvider superModelProvider,
ConfigserverConfig configserverConfig) {
this.zone = superModelProvider.getZone();
- this.configServerHostnames = configserverConfig.zookeeperserver().stream()
- .map(server -> server.hostname())
- .collect(Collectors.toList());
+ this.configServerHostnames = toConfigServerList(configserverConfig);
superModelListener.start(superModelProvider);
}
+ private List<String> toConfigServerList(ConfigserverConfig configserverConfig) {
+ if (configserverConfig.multitenant()) {
+ return configserverConfig.zookeeperserver().stream()
+ .map(server -> server.hostname())
+ .collect(Collectors.toList());
+ }
+
+ return Collections.emptyList();
+ }
+
@Override
public Map<ApplicationInstanceReference,
ApplicationInstance<ServiceMonitorStatus>> queryStatusOfAllApplicationInstances() {