use of io.hops.hopsworks.alerting.api.alert.dto.AlertGroup in project hopsworks by logicalclocks.
the class AlertBuilder method items.
private AlertGroupDTO items(AlertGroupDTO dto, UriInfo uriInfo, ResourceRequest resourceRequest, AlertFilterBy alertFilterBy, Project project) throws AlertException {
uri(dto, uriInfo);
expandAlertGroups(dto, resourceRequest);
if (dto.isExpand()) {
List<AlertGroup> alertGroups;
try {
if (project != null) {
alertGroups = alertManager.getAlertGroups(alertFilterBy.isActive(), alertFilterBy.isSilenced(), alertFilterBy.isInhibited(), alertFilterBy.getFilter(), alertFilterBy.getReceiver(), project);
} else {
alertGroups = alertManager.getAlertGroups(alertFilterBy.isActive(), alertFilterBy.isSilenced(), alertFilterBy.isInhibited(), alertFilterBy.getFilter(), alertFilterBy.getReceiver());
}
} catch (AlertManagerResponseException a) {
throw new AlertException(RESTCodes.AlertErrorCode.RESPONSE_ERROR, Level.FINE, a.getMessage());
} catch (AlertManagerClientCreateException | AlertManagerUnreachableException e) {
throw new AlertException(RESTCodes.AlertErrorCode.FAILED_TO_CONNECT, Level.FINE, e.getMessage());
} catch (AlertManagerAccessControlException e) {
throw new AlertException(RESTCodes.AlertErrorCode.ACCESS_CONTROL_EXCEPTION, Level.FINE, e.getMessage());
}
dto.setCount((long) alertGroups.size());
return items(dto, uriInfo, resourceRequest, alertGroups);
}
return dto;
}
use of io.hops.hopsworks.alerting.api.alert.dto.AlertGroup in project hopsworks by logicalclocks.
the class AlertManager method getAlertGroups.
public List<AlertGroup> getAlertGroups(Boolean active, Boolean silenced, Boolean inhibited, Set<String> filters, String receiver) throws AlertManagerResponseException, AlertManagerClientCreateException, AlertManagerUnreachableException {
doClientSanityCheck();
try {
List<AlertGroup> response = client.getAlertGroups(active, silenced, inhibited, filters, receiver);
registerSuccess();
return response;
} catch (AlertManagerServerException e) {
registerServerError();
throw new AlertManagerUnreachableException("Alertmanager not reachable." + e.getMessage(), e);
}
}
Aggregations