Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CW publish failiures fix #584

Merged
merged 2 commits into from
Aug 9, 2019
Merged

Conversation

ashwing
Copy link
Contributor

@ashwing ashwing commented Aug 8, 2019

Issue #, if available:

Description of changes:
Making CW publish calls as blocking to reduce the throttling.
Disclosing the CW publish failures.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

@sahilpalvia sahilpalvia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for providing this. Just a quick comment.

} catch (CloudWatchException e) {
log.warn("Could not publish {} datums to CloudWatch", endIndex - startIndex, e);
// This needs to be blocking. Making it asynchronous leads to increased throttling.
cloudWatchClient.putMetricData(request.build()).get(PUT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add the timeout. Could you catch for specific exceptions instead of generic ones.

final AWSExceptionManager exceptionManager = new AWSExceptionManager();
exceptionManager.add(CloudWatchException.class, t -> t);
try {
    try {
        cloudWatchClient.putMetricData(request.build()).get();
    } catch (ExecutionException e) {
        throw exceptionManager.apply(e.getCause);
    } catch (InterruptedException e) {
        log.info("Interrupted, shutdown invoked");
    }
}
catch(CloudWatchException e) {
    log.warn("Exception thrown while publishing to CW", e);
} catch (Exception e) {
    log.error("Unknown issue while publishing to CW", e);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Synced up offline. We will go ahead with timeouts.

@sahilpalvia sahilpalvia merged commit 161590c into awslabs:master Aug 9, 2019
@sahilpalvia sahilpalvia added this to the v2.2.2 milestone Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants