diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncClient.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncClient.java index 7d9e54c01c..915809f1e5 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncClient.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncClient.java @@ -53,7 +53,7 @@ import com.google.common.util.concurrent.ListenableFuture; @FormParams(keys = "Version", values = CloudWatchAsyncClient.VERSION) @VirtualHost public interface CloudWatchAsyncClient { - public static final String VERSION = "2009-05-15"; + public static final String VERSION = "2010-08-01"; /** * @see CloudWatchClient#getMetricStatisticsInRegion @@ -64,7 +64,8 @@ public interface CloudWatchAsyncClient { @FormParams(keys = "Action", values = "GetMetricStatistics") ListenableFuture> getMetricStatisticsInRegion( @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, - @FormParam("MeasureName") String measureName, + @FormParam("MetricName") String metricName, + @FormParam("Namespace") String namespace, @FormParam("StartTime") @ParamParser(ISO8601Format.class) Date startTime, @FormParam("EndTime") @ParamParser(ISO8601Format.class) Date endTime, @FormParam("Period") int period, @FormParam("Statistics.member.1") String statistics); diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchClient.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchClient.java index 276bcef2d7..e39b54af39 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchClient.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchClient.java @@ -51,13 +51,15 @@ public interface CloudWatchClient { * * @param region * region to gather metrics in - * @param measureName + * @param metricName * The measure name that corresponds to the measure for the gathered metric. *

* note *

* Must be a valid collected metric with the corresponding measure name, please see * Available Amazon CloudWatch Metrics + * @param namespace + * The namespace of the metric (e.g. AWS/EC2) * @param startTime * The timestamp of the first datapoint to return, inclusive. We round your value down * to the nearest minute. You can set your start time for more than two weeks in the @@ -70,7 +72,7 @@ public interface CloudWatchClient { * @param statistics * The statistics to be returned for the given metric. ex. Average */ - Set getMetricStatisticsInRegion(@Nullable String region, String measureName, Date startTime, - Date endTime, int period, String statistics); + Set getMetricStatisticsInRegion(@Nullable String region, String metricName, String namespace, + Date startTime, Date endTime, int period, String statistics); } diff --git a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncClientTest.java b/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncClientTest.java index 72b549aed7..d061250a05 100644 --- a/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncClientTest.java +++ b/apis/cloudwatch/src/test/java/org/jclouds/cloudwatch/CloudWatchAsyncClientTest.java @@ -62,21 +62,21 @@ public class CloudWatchAsyncClientTest extends RestClientTest getEC2MetricStatisticsInRegion(String region) { Calendar cal = Calendar.getInstance(); - cal.add(Calendar.MINUTE, -1); + cal.add(Calendar.MINUTE, -60 * 24 * 3); // 3 days Set datapoints = client.getMetricStatisticsInRegion( - region, "CPUUtilization", cal.getTime(), new Date(), 60, "Average"); - assert datapoints != null; + region, "CPUUtilization", "AWS/EC2", cal.getTime(), new Date(), 180, "Average"); + + return checkNotNull(datapoints, "Got null response for EC2 datapoints in region "); } @AfterTest diff --git a/providers/aws-cloudwatch/src/test/java/org/jclouds/aws/cloudwatch/AWSCloudWatchClientLiveTest.java b/providers/aws-cloudwatch/src/test/java/org/jclouds/aws/cloudwatch/AWSCloudWatchClientLiveTest.java index e494ad5403..5c98f38833 100644 --- a/providers/aws-cloudwatch/src/test/java/org/jclouds/aws/cloudwatch/AWSCloudWatchClientLiveTest.java +++ b/providers/aws-cloudwatch/src/test/java/org/jclouds/aws/cloudwatch/AWSCloudWatchClientLiveTest.java @@ -36,7 +36,7 @@ public class AWSCloudWatchClientLiveTest extends CloudWatchClientLiveTest { @Test public void testGetMetricStatisticsInRegion() { for (String region : Region.DEFAULT_REGIONS) { - getMetricStatisticsInRegion(region); + getEC2MetricStatisticsInRegion(region); } } } diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java index 9b10835a50..8558c8d2c6 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java @@ -155,8 +155,9 @@ public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest { try { Set datapoints = monitoringContext.getApi().getMetricStatisticsInRegion(instance.getRegion(), - "CPUUtilization", before, new Date(), 60, "Average"); - assert datapoints != null; + "CPUUtilization", "AWS/EC2", before, new Date(), 60, "Average"); + assert datapoints != null && datapoints.size() > 0; + } finally { monitoringContext.close(); }