Search in sources :

Example 1 with PostableSilence

use of io.hops.hopsworks.alerting.api.alert.dto.PostableSilence in project hopsworks by logicalclocks.

the class SilenceBuilder method getPostableSilence.

public PostableSilence getPostableSilence(PostableSilenceDTO postableSilenceDTO) {
    PostableSilence postableSilence = new PostableSilence();
    postableSilence.setId(postableSilenceDTO.getId());
    postableSilence.setComment(postableSilenceDTO.getComment());
    postableSilence.setEndsAt(postableSilenceDTO.getEndsAt());
    postableSilence.setStartsAt(postableSilenceDTO.getStartsAt());
    postableSilence.setMatchers(postableSilenceDTO.getMatchers());
    return postableSilence;
}
Also used : PostableSilence(io.hops.hopsworks.alerting.api.alert.dto.PostableSilence)

Example 2 with PostableSilence

use of io.hops.hopsworks.alerting.api.alert.dto.PostableSilence in project hopsworks by logicalclocks.

the class AdminSilenceResource method postSilence.

private SilenceID postSilence(PostableSilenceDTO postableSilenceDTO, Users users) throws AlertException {
    PostableSilence postableSilence = silenceBuilder.getPostableSilence(postableSilenceDTO);
    postableSilence.setCreatedBy(users.getEmail());
    try {
        return alertManager.postSilences(postableSilence);
    } catch (AlertManagerClientCreateException | AlertManagerUnreachableException e) {
        throw new AlertException(RESTCodes.AlertErrorCode.FAILED_TO_CONNECT, Level.FINE, e.getMessage());
    } catch (AlertManagerResponseException e) {
        throw new AlertException(RESTCodes.AlertErrorCode.RESPONSE_ERROR, Level.FINE, e.getMessage());
    }
}
Also used : PostableSilence(io.hops.hopsworks.alerting.api.alert.dto.PostableSilence) AlertManagerUnreachableException(io.hops.hopsworks.alert.exception.AlertManagerUnreachableException) AlertException(io.hops.hopsworks.exceptions.AlertException) AlertManagerResponseException(io.hops.hopsworks.alerting.exceptions.AlertManagerResponseException) AlertManagerClientCreateException(io.hops.hopsworks.alerting.exceptions.AlertManagerClientCreateException)

Aggregations

PostableSilence (io.hops.hopsworks.alerting.api.alert.dto.PostableSilence)2 AlertManagerUnreachableException (io.hops.hopsworks.alert.exception.AlertManagerUnreachableException)1 AlertManagerClientCreateException (io.hops.hopsworks.alerting.exceptions.AlertManagerClientCreateException)1 AlertManagerResponseException (io.hops.hopsworks.alerting.exceptions.AlertManagerResponseException)1 AlertException (io.hops.hopsworks.exceptions.AlertException)1