Search in sources :

Example 21 with AlertManagerUnreachableException

use of io.hops.hopsworks.alert.exception.AlertManagerUnreachableException in project hopsworks by logicalclocks.

the class AlertManager method getSilence.

public Silence getSilence(String uuid) throws AlertManagerResponseException, AlertManagerClientCreateException, AlertManagerUnreachableException {
    doClientSanityCheck();
    try {
        Silence response = client.getSilence(uuid);
        registerSuccess();
        return response;
    } catch (AlertManagerServerException e) {
        registerServerError();
        throw new AlertManagerUnreachableException("Alertmanager not reachable." + e.getMessage(), e);
    }
}
Also used : PostableSilence(io.hops.hopsworks.alerting.api.alert.dto.PostableSilence) Silence(io.hops.hopsworks.alerting.api.alert.dto.Silence) AlertManagerUnreachableException(io.hops.hopsworks.alert.exception.AlertManagerUnreachableException) AlertManagerServerException(io.hops.hopsworks.alerting.exceptions.AlertManagerServerException)

Example 22 with AlertManagerUnreachableException

use of io.hops.hopsworks.alert.exception.AlertManagerUnreachableException in project hopsworks by logicalclocks.

the class AlertManager method getAlerts.

public List<Alert> getAlerts(Boolean active, Boolean silenced, Boolean inhibited, Boolean unprocessed, Set<String> filters, String receiver) throws AlertManagerResponseException, AlertManagerClientCreateException, AlertManagerUnreachableException {
    doClientSanityCheck();
    try {
        List<Alert> response = client.getAlerts(active, silenced, inhibited, unprocessed, filters, receiver);
        registerSuccess();
        return response;
    } catch (AlertManagerServerException e) {
        registerServerError();
        throw new AlertManagerUnreachableException("Alertmanager not reachable." + e.getMessage(), e);
    }
}
Also used : AlertManagerUnreachableException(io.hops.hopsworks.alert.exception.AlertManagerUnreachableException) Alert(io.hops.hopsworks.alerting.api.alert.dto.Alert) PostableAlert(io.hops.hopsworks.alerting.api.alert.dto.PostableAlert) AlertManagerServerException(io.hops.hopsworks.alerting.exceptions.AlertManagerServerException)

Example 23 with AlertManagerUnreachableException

use of io.hops.hopsworks.alert.exception.AlertManagerUnreachableException in project hopsworks by logicalclocks.

the class AlertManager method getStatus.

public AlertmanagerStatus getStatus() throws AlertManagerResponseException, AlertManagerClientCreateException, AlertManagerUnreachableException {
    doClientSanityCheck();
    try {
        AlertmanagerStatus response = client.getStatus();
        registerSuccess();
        return response;
    } catch (AlertManagerServerException e) {
        registerServerError();
        throw new AlertManagerUnreachableException("Alertmanager not reachable." + e.getMessage(), e);
    }
}
Also used : AlertManagerUnreachableException(io.hops.hopsworks.alert.exception.AlertManagerUnreachableException) AlertManagerServerException(io.hops.hopsworks.alerting.exceptions.AlertManagerServerException) AlertmanagerStatus(io.hops.hopsworks.alerting.api.alert.dto.AlertmanagerStatus)

Example 24 with AlertManagerUnreachableException

use of io.hops.hopsworks.alert.exception.AlertManagerUnreachableException in project hopsworks by logicalclocks.

the class AlertManager method getSilences.

public List<Silence> getSilences(Set<String> filters) throws AlertManagerResponseException, AlertManagerClientCreateException, AlertManagerUnreachableException {
    doClientSanityCheck();
    try {
        List<Silence> response = client.getSilences(filters);
        registerSuccess();
        return response;
    } catch (AlertManagerServerException e) {
        registerServerError();
        throw new AlertManagerUnreachableException("Alertmanager not reachable." + e.getMessage(), e);
    }
}
Also used : PostableSilence(io.hops.hopsworks.alerting.api.alert.dto.PostableSilence) Silence(io.hops.hopsworks.alerting.api.alert.dto.Silence) AlertManagerUnreachableException(io.hops.hopsworks.alert.exception.AlertManagerUnreachableException) AlertManagerServerException(io.hops.hopsworks.alerting.exceptions.AlertManagerServerException)

Example 25 with AlertManagerUnreachableException

use of io.hops.hopsworks.alert.exception.AlertManagerUnreachableException in project hopsworks by logicalclocks.

the class FeatureGroupAlertResource method getTestById.

@POST
@Path("{id}/test")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Test alert by Id.", response = ProjectAlertsDTO.class)
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@JWTRequired(acceptedTokens = { Audience.API }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response getTestById(@PathParam("id") Integer id, @Context UriInfo uriInfo, @Context SecurityContext sc) throws AlertException {
    FeatureGroupAlert featureGroupAlert = featureGroupAlertFacade.findByFeatureGroupAndId(featuregroup, id);
    List<Alert> alerts;
    try {
        alerts = alertController.testAlert(featuregroup.getFeaturestore().getProject(), featureGroupAlert);
    } catch (AlertManagerUnreachableException | AlertManagerClientCreateException 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());
    } catch (AlertManagerResponseException e) {
        throw new AlertException(RESTCodes.AlertErrorCode.RESPONSE_ERROR, Level.FINE, e.getMessage());
    }
    ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.ALERTS);
    AlertDTO alertDTO = alertBuilder.getAlertDTOs(uriInfo, resourceRequest, alerts, featuregroup.getFeaturestore().getProject());
    return Response.ok().entity(alertDTO).build();
}
Also used : AlertDTO(io.hops.hopsworks.api.alert.AlertDTO) FeatureGroupAlert(io.hops.hopsworks.persistence.entity.featurestore.featuregroup.datavalidation.alert.FeatureGroupAlert) AlertManagerUnreachableException(io.hops.hopsworks.alert.exception.AlertManagerUnreachableException) AlertManagerAccessControlException(io.hops.hopsworks.alert.exception.AlertManagerAccessControlException) FeatureGroupAlert(io.hops.hopsworks.persistence.entity.featurestore.featuregroup.datavalidation.alert.FeatureGroupAlert) Alert(io.hops.hopsworks.alerting.api.alert.dto.Alert) ResourceRequest(io.hops.hopsworks.common.api.ResourceRequest) AlertException(io.hops.hopsworks.exceptions.AlertException) AlertManagerResponseException(io.hops.hopsworks.alerting.exceptions.AlertManagerResponseException) AlertManagerClientCreateException(io.hops.hopsworks.alerting.exceptions.AlertManagerClientCreateException) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) JWTRequired(io.hops.hopsworks.jwt.annotation.JWTRequired) ApiOperation(io.swagger.annotations.ApiOperation) AllowedProjectRoles(io.hops.hopsworks.api.filter.AllowedProjectRoles)

Aggregations

AlertManagerUnreachableException (io.hops.hopsworks.alert.exception.AlertManagerUnreachableException)34 AlertManagerClientCreateException (io.hops.hopsworks.alerting.exceptions.AlertManagerClientCreateException)21 AlertException (io.hops.hopsworks.exceptions.AlertException)20 JWTRequired (io.hops.hopsworks.jwt.annotation.JWTRequired)16 Produces (javax.ws.rs.Produces)16 AlertManagerConfigCtrlCreateException (io.hops.hopsworks.alerting.exceptions.AlertManagerConfigCtrlCreateException)14 AlertManagerConfigReadException (io.hops.hopsworks.alerting.exceptions.AlertManagerConfigReadException)14 AlertManagerConfigUpdateException (io.hops.hopsworks.alerting.exceptions.AlertManagerConfigUpdateException)14 AlertManagerServerException (io.hops.hopsworks.alerting.exceptions.AlertManagerServerException)13 Consumes (javax.ws.rs.Consumes)13 Path (javax.ws.rs.Path)12 ResourceRequest (io.hops.hopsworks.common.api.ResourceRequest)11 ApiOperation (io.swagger.annotations.ApiOperation)11 AlertManagerAccessControlException (io.hops.hopsworks.alert.exception.AlertManagerAccessControlException)10 AlertManagerDuplicateEntryException (io.hops.hopsworks.alerting.exceptions.AlertManagerDuplicateEntryException)8 POST (javax.ws.rs.POST)8 PUT (javax.ws.rs.PUT)8 AlertManagerNoSuchElementException (io.hops.hopsworks.alerting.exceptions.AlertManagerNoSuchElementException)7 AlertManagerResponseException (io.hops.hopsworks.alerting.exceptions.AlertManagerResponseException)7 AllowedProjectRoles (io.hops.hopsworks.api.filter.AllowedProjectRoles)7