diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-10-27 17:06:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-27 17:06:47 +0200 |
commit | 5436fcb54be30fc9b2eb2457332307fb1d631042 (patch) | |
tree | f870b5763b954fc503c317a88eec7cedf4440ac3 | |
parent | 0dc98cf8b3ad24ceb87044ee077879af9f4686b4 (diff) | |
parent | 5c5ff58de17f138d50fb8484bfce33e7227f30a8 (diff) |
Merge pull request #24616 from vespa-engine/jonmv/break-when-stopped
Break fetching metrics when stopped
-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); |