summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java28
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/metrics/MetricsAggregator.java4
-rw-r--r--searchlib/src/vespa/searchlib/predicate/predicate_index.h2
-rw-r--r--searchlib/src/vespa/searchlib/predicate/simple_index.h4
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h2
5 files changed, 23 insertions, 17 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
index 970b0e080d6..bbae38aa0a4 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
@@ -791,26 +791,32 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
/** Finds the hosts of an application, grouped by cluster name */
private Collection<ClusterInfo> getClustersOfApplication(ApplicationId applicationId) {
Application application = getApplication(applicationId);
- Map<String, List<URI>> clusterHosts = new HashMap<>();
Map<String, ClusterInfo> clusters = new HashMap<>();
application.getModel().getHosts().stream()
.filter(host -> host.getServices().stream().noneMatch(serviceInfo -> serviceInfo.getServiceType().equalsIgnoreCase("logserver")))
.forEach(hostInfo -> {
- log.info(hostInfo.getHostname() + ": " + hostInfo.getServices().stream().map(ServiceInfo::getServiceType).collect(Collectors.joining(", ")));
- ServiceInfo serviceInfo = hostInfo.getServices().stream().filter(service -> METRICS_PROXY_CONTAINER.serviceName.equals(service.getServiceType()))
- .findFirst().orElseThrow(() -> new IllegalArgumentException("Unable to find service " + METRICS_PROXY_CONTAINER.serviceName.toString()));
- String clusterName = serviceInfo.getProperty("clusterid").orElse("");
- String clusterTypeString = serviceInfo.getProperty("clustertype").orElse("");
- if (!ClusterInfo.ClusterType.isValidType(clusterTypeString)) return;
- ClusterInfo.ClusterType clusterType = ClusterInfo.ClusterType.valueOf(clusterTypeString);
- URI host = URI.create("http://" + hostInfo.getHostname() + ":" + servicePort(serviceInfo) + "/metrics/v1/values?consumer=Vespa");
- clusterHosts.computeIfAbsent(clusterName, l -> new ArrayList<URI>()).add(host);
- clusters.computeIfAbsent(clusterName, c -> new ClusterInfo(clusterName, clusterType)).addHost(host);
+ ServiceInfo metricsService = getServiceInfoByType(hostInfo, METRICS_PROXY_CONTAINER.serviceName);
+ ServiceInfo clusterServiceInfo = getServiceInfoByType(hostInfo, "container", "searchnode");
+ ClusterInfo clusterInfo = createClusterInfo(clusterServiceInfo);
+ URI host = URI.create("http://" + hostInfo.getHostname() + ":" + servicePort(metricsService) + "/metrics/v1/values?consumer=Vespa");
+ clusters.computeIfAbsent(clusterInfo.getClusterId(), c -> clusterInfo).addHost(host);
}
);
return clusters.values();
}
+
+ private ServiceInfo getServiceInfoByType(HostInfo hostInfo, String... types) {
+ List<String> type = List.of(types);
+ return hostInfo.getServices().stream().filter(serviceInfo -> type.contains(serviceInfo.getServiceType())).findFirst().orElseThrow();
+ }
+
+ private ClusterInfo createClusterInfo(ServiceInfo serviceInfo) {
+ String clusterName = serviceInfo.getServiceName();
+ ClusterInfo.ClusterType clusterType = serviceInfo.getServiceType().equals("searchnode") ? ClusterInfo.ClusterType.content : ClusterInfo.ClusterType.container;
+ return new ClusterInfo(clusterName, clusterType);
+ }
+
/** Returns version to use when deploying application in given environment */
static Version decideVersion(ApplicationId application, Environment environment, Version sessionVersion, boolean bootstrap) {
if ( environment.isManuallyDeployed()
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/MetricsAggregator.java b/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/MetricsAggregator.java
index c6b2131863d..8fa08275ad5 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/MetricsAggregator.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/MetricsAggregator.java
@@ -42,7 +42,7 @@ public class MetricsAggregator {
}
public Optional<Double> aggregateFeedLatency() {
- return Optional.ofNullable(feed).map(m -> m.latencySum / m.latencyCount);
+ return Optional.ofNullable(feed).map(m -> m.latencySum / m.latencyCount).filter(num -> !num.isNaN());
}
@@ -54,7 +54,7 @@ public class MetricsAggregator {
if (container == null && qr == null) return Optional.empty();
var c = Optional.ofNullable(container).orElseGet(LatencyMetrics::new);
var q = Optional.ofNullable(qr).orElseGet(LatencyMetrics::new);
- return Optional.of((c.latencySum + q.latencySum) / (c.latencyCount + q.latencyCount));
+ return Optional.of((c.latencySum + q.latencySum) / (c.latencyCount + q.latencyCount)).filter(num -> !num.isNaN());
}
public Optional<Double> aggregateQueryRate() {
diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_index.h b/searchlib/src/vespa/searchlib/predicate/predicate_index.h
index 196c1df16de..b0fb0eda4c5 100644
--- a/searchlib/src/vespa/searchlib/predicate/predicate_index.h
+++ b/searchlib/src/vespa/searchlib/predicate/predicate_index.h
@@ -29,7 +29,7 @@ class PredicateIndex : public PopulateInterface {
using FeatureMap = std::unordered_map<uint64_t, std::vector<IntervalT>>;
using generation_t = vespalib::GenerationHandler::generation_t;
template <typename T>
- using optional = std::experimental::optional<T>;
+ using optional = std::optional<T>;
public:
typedef std::unique_ptr<PredicateIndex> UP;
diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.h b/searchlib/src/vespa/searchlib/predicate/simple_index.h
index 4edc0ff2d14..986b46d7008 100644
--- a/searchlib/src/vespa/searchlib/predicate/simple_index.h
+++ b/searchlib/src/vespa/searchlib/predicate/simple_index.h
@@ -6,7 +6,7 @@
#include <vespa/vespalib/btree/btreestore.h>
#include <vespa/vespalib/data/databuffer.h>
#include <vespa/vespalib/util/rcuvector.h>
-#include <experimental/optional>
+#include <optional>
namespace search::predicate {
@@ -139,7 +139,7 @@ private:
using GenerationHolder = vespalib::GenerationHolder;
using generation_t = vespalib::GenerationHandler::generation_t;
template <typename T>
- using optional = std::experimental::optional<T>;
+ using optional = std::optional<T>;
Dictionary _dictionary;
BTreeStore _btree_posting_lists;
diff --git a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h
index 3d92b19c421..16b725cd4b0 100644
--- a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h
+++ b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h
@@ -56,7 +56,7 @@ private:
using BTreeIterator = predicate::SimpleIndex<datastore::EntryRef>::BTreeIterator;
using VectorIterator = predicate::SimpleIndex<datastore::EntryRef>::VectorIterator;
template <typename T>
- using optional = std::experimental::optional<T>;
+ using optional = std::optional<T>;
using Alloc = vespalib::alloc::Alloc;
const PredicateAttribute & predicate_attribute() const {