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;
}
}
}
Aggregations