use of com.b2international.index.es.client.EsClusterStatus in project snow-owl by b2ihealthcare.
the class TerminologyRepository method status.
@Override
public RepositoryInfo status() {
// by default assume it is in GREEN status with no diagnosis
Health health = Health.GREEN;
String diagnosis = "";
final String[] indices = service(Index.class).admin().indices();
final EsClusterStatus status = service(IndexClient.class).client().status(indices);
if (!status.isAvailable()) {
// check if cluster is available or not, and report RED state if not along with index diagnosis
health = Health.RED;
diagnosis = status.getDiagnosis();
} else if (!status.isHealthy(indices)) {
// check if index is healthy and report RED if not along with diagnosis
health = Health.RED;
diagnosis = String.format("Repository indices '%s' are not healthy.", Arrays.toString(indices));
}
return RepositoryInfo.of(id(), health, diagnosis, status.getIndices());
}
use of com.b2international.index.es.client.EsClusterStatus in project snow-owl by b2ihealthcare.
the class ServerInfoGetRequest method execute.
@Override
public ServerInfo execute(ServiceProvider context) {
final Version version = Platform.getBundle(CoreActivator.PLUGIN_ID).getVersion();
final String description = context.service(SnowOwlConfiguration.class).getDescription();
final Repositories repositories = RepositoryRequests.prepareSearch().build().execute(context);
final Set<String> repositoryIndices = repositories.stream().map(RepositoryInfo::indices).flatMap(List::stream).map(EsIndexStatus::getIndex).collect(Collectors.toSet());
// this represents the current full cluster status with all global and terminology plugin specific indices
EsClusterStatus clusterStatus = context.service(EsClient.class).status();
// append global indices to the server info response
final List<EsIndexStatus> globalIndices = clusterStatus.getIndices().stream().filter(indexStatus -> !repositoryIndices.contains(indexStatus.getIndex())).collect(Collectors.toList());
EsClusterStatus globalStatus = new EsClusterStatus(clusterStatus.isAvailable(), clusterStatus.getDiagnosis(), globalIndices);
return new ServerInfo(version.toString(), description, repositories, globalStatus);
}
Aggregations