Closed danwhitfield closed 10 years ago
Oh turns out there is already handling for this in the latest version (0.3.3).
https://github.com/blacklocus/metrics-cloudwatch/commit/baf6e5fd16353cb11cbe113b1330f5892b5ab758
Are you still seeing statistic sets of size 0 attempting to be submitted to cloudwatch on that version?
I am still seeing exceptions in the logs:
ERROR [2014-08-10 20:22:42,732] com.blacklocus.metrics.CloudWatchReporter: Exception reporting metrics to CloudWatch. The data sent in this CloudWatch API request may have been discarded. ! com.amazonaws.services.cloudwatch.model.InvalidParameterValueException: Status Code: 400, AWS Service: AmazonCloudWatch, AWS Request ID: 15455536-20cc-11e4-be0f-6b59bf4da1d7, AWS Error Code: InvalidParameterValue, AWS Error Message: The parameter MetricData.member.1.StatisticValues.SampleCount must not equal 0. ! at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:753) ~[aws-java-sdk-1.6.3.jar:na]
Could you confirm if I am using the correct version number?
<dependency>
<groupId>com.blacklocus</groupId>
<artifactId>metrics-cloudwatch</artifactId>
<version>0.3</version>
</dependency>
There is an 0.3.3
<dependency>
<groupId>com.blacklocus</groupId>
<artifactId>metrics-cloudwatch</artifactId>
<version>0.3.3</version>
</dependency>
Excellent! Thanks for that, great work on this too, very useful :+1:
CloudWatch does not accept a sample count of zero, therefore the sampling method in the CloudWatchReported class needs:
// Do not send any sample sizes of zero. if (snapshot.size() == 0) { return; }
Without this, many metrics are lost due to the throwing of an InvalidParameterValueException.