Search in sources :

Example 1 with AvailabilityResponse

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;
    }
}
Also used : ApiEntity(io.gravitee.management.model.ApiEntity) AvailabilityResponse(io.gravitee.repository.healthcheck.query.availability.AvailabilityResponse) AnalyticsException(io.gravitee.repository.analytics.AnalyticsException) TechnicalManagementException(io.gravitee.management.service.exceptions.TechnicalManagementException)

Aggregations

ApiEntity (io.gravitee.management.model.ApiEntity)1 TechnicalManagementException (io.gravitee.management.service.exceptions.TechnicalManagementException)1 AnalyticsException (io.gravitee.repository.analytics.AnalyticsException)1 AvailabilityResponse (io.gravitee.repository.healthcheck.query.availability.AvailabilityResponse)1