diff options
author | Ola Aunrønning <olaa@verizonmedia.com> | 2019-09-18 13:55:06 +0200 |
---|---|---|
committer | Ola Aunrønning <olaa@verizonmedia.com> | 2019-09-18 14:42:36 +0200 |
commit | d7e9109f6ab6a147efcbfc99093c48cdad8d0e0a (patch) | |
tree | cf0a84a4317c12167fdb7741644bae3a26baa0c2 /configserver | |
parent | 134e4257fcf36ad964c3da330c2a8bf9ced7ba84 (diff) |
Set request timeout. Keep fetching metrics, even if it fails for one zone
Diffstat (limited to 'configserver')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/metrics/ClusterMetricsRetriever.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/ClusterMetricsRetriever.java b/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/ClusterMetricsRetriever.java index c23af021e3b..ffa820bd433 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/ClusterMetricsRetriever.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/ClusterMetricsRetriever.java @@ -6,6 +6,8 @@ import com.yahoo.slime.ArrayTraverser; import com.yahoo.slime.Inspector; import com.yahoo.slime.Slime; import com.yahoo.vespa.config.SlimeUtils; +import com.yahoo.yolean.Exceptions; +import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; @@ -39,7 +41,12 @@ public class ClusterMetricsRetriever { private static final List<String> WANTED_METRIC_SERVICES = List.of(VESPA_CONTAINER, VESPA_QRSERVER, VESPA_DISTRIBUTOR); - private static final CloseableHttpClient httpClient = VespaHttpClientBuilder.create().build(); + private static final CloseableHttpClient httpClient = VespaHttpClientBuilder.create() + .setDefaultRequestConfig(RequestConfig.custom() + .setConnectTimeout(10 * 1000) + .setSocketTimeout(10 * 1000) + .build()) + .build(); /** * Call the metrics API on each host and aggregate the metrics @@ -88,7 +95,7 @@ public class ClusterMetricsRetriever { return slime; } catch (IOException e) { // Usually caused by applications being deleted during metric retrieval - log.warning("Was unable to fetch metrics from " + hostURI); + log.warning("Was unable to fetch metrics from " + hostURI + " : " + Exceptions.toMessageString(e)); return new Slime(); } } |