use of io.gravitee.repository.healthcheck.query.availability.AvailabilityResponse in project gravitee-management-rest-api by gravitee-io.
the class HealthCheckServiceImpl method getAvailability.
@Override
public ApiMetrics getAvailability(String api, String field) {
logger.debug("Run health availability query for API '{}'", api);
try {
ApiEntity apiEntity = apiService.findById(api);
AvailabilityResponse response = healthCheckRepository.query(QueryBuilders.availability().api(api).field(AvailabilityQuery.Field.valueOf(field)).build());
return convert(apiEntity, response.getEndpointAvailabilities(), field);
} catch (Exception ex) {
logger.error("An unexpected error occurs while searching for health data.", ex);
return null;
}
}
Aggregations