Search in sources :

Example 1 with MetricsService

use of com.yahoo.vespa.hosted.controller.api.integration.MetricsService in project vespa by vespa-engine.

the class DeploymentMetricsMaintainer method maintain.

@Override
protected void maintain() {
    boolean hasWarned = false;
    for (Application application : ApplicationList.from(controller().applications().asList()).notPullRequest().asList()) {
        try {
            controller().applications().lockIfPresent(application.id(), lockedApplication -> controller().applications().store(lockedApplication.with(controller().metricsService().getApplicationMetrics(application.id()))));
            for (Deployment deployment : application.deployments().values()) {
                MetricsService.DeploymentMetrics deploymentMetrics = controller().metricsService().getDeploymentMetrics(application.id(), deployment.zone());
                DeploymentMetrics appMetrics = new DeploymentMetrics(deploymentMetrics.queriesPerSecond(), deploymentMetrics.writesPerSecond(), deploymentMetrics.documentCount(), deploymentMetrics.queryLatencyMillis(), deploymentMetrics.writeLatencyMillis());
                controller().applications().lockIfPresent(application.id(), lockedApplication -> controller().applications().store(lockedApplication.with(deployment.zone(), appMetrics)));
            }
        } catch (UncheckedIOException e) {
            if (// produce only one warning per maintenance interval
            !hasWarned)
                log.log(Level.WARNING, "Failed talking to YAMAS: " + Exceptions.toMessageString(e) + ". Retrying in " + maintenanceInterval());
            hasWarned = true;
        }
    }
}
Also used : DeploymentMetrics(com.yahoo.vespa.hosted.controller.application.DeploymentMetrics) MetricsService(com.yahoo.vespa.hosted.controller.api.integration.MetricsService) Deployment(com.yahoo.vespa.hosted.controller.application.Deployment) UncheckedIOException(java.io.UncheckedIOException) Application(com.yahoo.vespa.hosted.controller.Application)

Aggregations

Application (com.yahoo.vespa.hosted.controller.Application)1 MetricsService (com.yahoo.vespa.hosted.controller.api.integration.MetricsService)1 Deployment (com.yahoo.vespa.hosted.controller.application.Deployment)1 DeploymentMetrics (com.yahoo.vespa.hosted.controller.application.DeploymentMetrics)1 UncheckedIOException (java.io.UncheckedIOException)1