@Override
    protected double maintain() {
        int attempts = 0;
        var failures = new MutableInteger(0);
        try {
            Set<ApplicationId> applications = activeNodesByApplication().keySet();
            if (applications.isEmpty()) return 1.0;

            long pauseMs = interval().toMillis() / Math.max(4, applications.size()); // spread requests over interval
            int done = 0;
            for (ApplicationId application : applications) {
                if (shuttingDown()) return asSuccessFactorDeviation(attempts, failures.get());

                attempts++;
                metricsFetcher.fetchMetrics(application)
                              .whenComplete((metricsResponse, exception) -> handleResponse(metricsResponse,
                                                                                           exception,
                                                                                           failures,
                                                                                           application));
                if (++done < applications.size())
                    Thread.sleep(pauseMs);
            }

            nodeRepository().metricsDb().gc();

            return asSuccessFactorDeviation(attempts, failures.get());
        }
        catch (InterruptedException e) {
            return asSuccessFactorDeviation(attempts, failures.get());
        }
    }
Maintainer which keeps the node metric db up to date by periodically fetching metrics from all active nodes.

@author bratseth
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/NodeMetricsDbMaintainer.java