use of com.yahoo.vespa.hosted.controller.versions.VespaVersion in project vespa by vespa-engine.
the class DeploymentApiHandler method root.
private HttpResponse root(HttpRequest request) {
Slime slime = new Slime();
Cursor root = slime.setObject();
Cursor platformArray = root.setArray("versions");
for (VespaVersion version : controller.versionStatus().versions()) {
Cursor versionObject = platformArray.addObject();
versionObject.setString("version", version.versionNumber().toString());
versionObject.setString("confidence", version.confidence().name());
versionObject.setString("commit", version.releaseCommit());
versionObject.setLong("date", version.committedAt().toEpochMilli());
versionObject.setBool("controllerVersion", version.isSelfVersion());
versionObject.setBool("systemVersion", version.isCurrentSystemVersion());
Cursor configServerArray = versionObject.setArray("configServers");
for (String configServerHostnames : version.configServerHostnames()) {
Cursor configServerObject = configServerArray.addObject();
configServerObject.setString("hostname", configServerHostnames);
}
Cursor failingArray = versionObject.setArray("failingApplications");
for (ApplicationId id : version.statistics().failing()) {
controller.applications().get(id).ifPresent(application -> {
firstFailingOn(version.versionNumber(), application).ifPresent(firstFailing -> {
Cursor applicationObject = failingArray.addObject();
toSlime(applicationObject, application, request);
applicationObject.setString("failing", firstFailing.type().jobName());
});
});
}
Cursor productionArray = versionObject.setArray("productionApplications");
for (ApplicationId id : version.statistics().production()) {
controller.applications().get(id).ifPresent(application -> {
int successes = productionSuccessesFor(version.versionNumber(), application);
// Just upgraded to a newer version.
if (successes == 0)
return;
Cursor applicationObject = productionArray.addObject();
toSlime(applicationObject, application, request);
applicationObject.setLong("productionJobs", productionJobsFor(application));
applicationObject.setLong("productionSuccesses", productionSuccessesFor(version.versionNumber(), application));
});
}
Cursor runningArray = versionObject.setArray("deployingApplications");
for (ApplicationId id : version.statistics().deploying()) {
controller.applications().get(id).ifPresent(application -> {
lastDeployingTo(version.versionNumber(), application).ifPresent(lastDeploying -> {
Cursor applicationObject = runningArray.addObject();
toSlime(applicationObject, application, request);
applicationObject.setString("running", lastDeploying.type().jobName());
});
});
}
}
return new SlimeJsonResponse(slime);
}
use of com.yahoo.vespa.hosted.controller.versions.VespaVersion in project vespa by vespa-engine.
the class ScrewdriverApiHandler method vespaVersion.
private HttpResponse vespaVersion() {
VespaVersion version = controller.versionStatus().version(controller.systemVersion());
if (version == null)
return ErrorResponse.notFoundError("Information about the current system version is not available at this time");
Slime slime = new Slime();
Cursor cursor = slime.setObject();
cursor.setString("version", version.versionNumber().toString());
cursor.setString("sha", version.releaseCommit());
cursor.setLong("date", version.committedAt().toEpochMilli());
return new SlimeJsonResponse(slime);
}
Aggregations