/** * Returns the count of metrics stored for the given nodeId and region. * * @param cloudWatchClient the cloud watch client (Will use MetricsClient when Issue 922 is fixed) * @param region the region the instance is in * @param nodeId the instance id * * @return the total count of metrics stored for the given instance id and region */ private static int getMetricsCountForInstance(CloudWatchClient cloudWatchClient, String region, String nodeId) { // Uses CloudWatchClient+region instead of MetricsClient because the pagination helper only works with // CloudWatchClient: http://code.google.com/p/jclouds/issues/detail?id=922 return Iterators.size(CloudWatch.listMetrics(cloudWatchClient, region, ListMetricsOptions.builder() // Only return metrics for the given instance .dimension(new Dimension( EC2Constants.Dimension.INSTANCE_ID, nodeId)) .build()).iterator()); }
ListMetricsOptions lmOptions = ListMetricsOptions.builder()