diff options
author | Ola Aunrønning <olaa@verizonmedia.com> | 2020-07-08 16:20:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-08 16:20:57 +0200 |
commit | 77491b751afb87d6729b63b588c5617aea440caa (patch) | |
tree | 5c490d3fa93ed9a3873180375084fa6bd8fd430e /controller-server | |
parent | acbc74544cc3475281e898167b4c07a73b84258f (diff) | |
parent | a9582ea01ea1da9ba70c64a67ea285c68581bbe9 (diff) |
Merge pull request #13832 from vespa-engine/mpolden/reduce-logging
Reduce logging from ResourceMeterMaintainer
Diffstat (limited to 'controller-server')
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainer.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainer.java index d57d6ff0976..76a186a2f6b 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceMeterMaintainer.java @@ -11,6 +11,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node; import com.yahoo.vespa.hosted.controller.api.integration.configserver.NodeRepository; import com.yahoo.vespa.hosted.controller.api.integration.resource.MeteringClient; import com.yahoo.vespa.hosted.controller.api.integration.resource.ResourceSnapshot; +import com.yahoo.yolean.Exceptions; import java.time.Clock; import java.time.Duration; @@ -18,10 +19,11 @@ import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Set; +import java.util.logging.Level; import java.util.stream.Collectors; /** - * Creates a ResourceSnapshot per application, which is then passed on to a MeteringClient + * Creates a {@link ResourceSnapshot} per application, which is then passed on to a MeteringClient * * @author olaa */ @@ -49,7 +51,15 @@ public class ResourceMeterMaintainer extends ControllerMaintainer { @Override protected void maintain() { + try { + collectResourceSnapshots(); + } catch (Exception e) { + log.log(Level.WARNING, "Failed to collect resource snapshots. Retrying in " + interval() + ". Error: " + + Exceptions.toMessageString(e)); + } + } + private void collectResourceSnapshots() { Collection<ResourceSnapshot> resourceSnapshots = getAllResourceSnapshots(); meteringClient.consume(resourceSnapshots); @@ -104,4 +114,5 @@ public class ResourceMeterMaintainer extends ControllerMaintainer { private boolean isNodeStateMeterable(Node node) { return METERABLE_NODE_STATES.contains(node.state()); } + } |