diff options
author | jonmv <venstad@gmail.com> | 2022-10-27 12:13:44 +0200 |
---|---|---|
committer | jonmv <venstad@gmail.com> | 2022-10-27 12:13:44 +0200 |
commit | 5c5ff58de17f138d50fb8484bfce33e7227f30a8 (patch) | |
tree | f070a9d37f7e9d376a51d690f0374b7b68c8bec9 /metrics-proxy/src | |
parent | 4ca182712758f3db0422050f83a270d84997ae42 (diff) |
Break fetching metrics when stopped
Diffstat (limited to 'metrics-proxy/src')
-rw-r--r-- | metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsRetriever.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsRetriever.java b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsRetriever.java index 900f7df6ea2..05b146bbacd 100644 --- a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsRetriever.java +++ b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsRetriever.java @@ -161,12 +161,13 @@ public class ApplicationMetricsRetriever extends AbstractComponent implements Ru int numOk = 0; int numTried = futures.size(); for (Map.Entry<Node, Future<Boolean>> entry : futures.entrySet()) { + if (stopped) break; try { Boolean result = entry.getValue().get(taskTimeout.get().toMillis(), TimeUnit.MILLISECONDS); - if ((result != null) && result) numOk++; + if (result == Boolean.TRUE) numOk++; } catch (InterruptedException | ExecutionException | TimeoutException e) { Throwable cause = e.getCause(); - if ( e instanceof ExecutionException && ((cause instanceof SocketException) || cause instanceof ConnectTimeoutException)) { + if (e instanceof ExecutionException && ((cause instanceof SocketException) || cause instanceof ConnectTimeoutException)) { log.log(Level.FINE, "Failed retrieving metrics for '" + entry.getKey() + "' : " + cause.getMessage()); } else { log.log(Level.WARNING, "Failed retrieving metrics for '" + entry.getKey() + "' : ", e); |