Class GetMetricStatisticsTask

  • All Implemented Interfaces:
    java.util.concurrent.Callable<com.amazonaws.services.cloudwatch.model.GetMetricStatisticsResult>

    public class GetMetricStatisticsTask
    extends java.lang.Object
    implements java.util.concurrent.Callable<com.amazonaws.services.cloudwatch.model.GetMetricStatisticsResult>
    A Callable task that, when executed, requests statistics for a particular metric to be fetched from AWS CloudWatch in a given region.

    The returned GetMetricStatisticsResponse object stores the query metric in its label field and will store the list of Datapoints sorted in increasing order of time stamp (oldest first).

    • Constructor Summary

      Constructors 
      Constructor Description
      GetMetricStatisticsTask​(java.lang.String awsAccessKeyId, java.lang.String awsSecretAccessKey, java.lang.String region, java.lang.String namespace, java.lang.String metric, java.util.List<CloudWatchStatistic> statistics, com.elastisys.scale.commons.json.types.TimeInterval period, java.util.Map<java.lang.String,​java.lang.String> dimensions, org.joda.time.Interval queryInterval)
      Constructs a new GetMetricStatisticsTask request.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.amazonaws.services.cloudwatch.model.GetMetricStatisticsResult call()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GetMetricStatisticsTask

        public GetMetricStatisticsTask​(java.lang.String awsAccessKeyId,
                                       java.lang.String awsSecretAccessKey,
                                       java.lang.String region,
                                       java.lang.String namespace,
                                       java.lang.String metric,
                                       java.util.List<CloudWatchStatistic> statistics,
                                       com.elastisys.scale.commons.json.types.TimeInterval period,
                                       java.util.Map<java.lang.String,​java.lang.String> dimensions,
                                       org.joda.time.Interval queryInterval)
        Constructs a new GetMetricStatisticsTask request.
        Parameters:
        awsAccessKeyId - AWS access key id for the account to be used.
        awsSecretAccessKey - AWS secret access key for the account to be used.
        region - The AWS region that the request will be sent to.
        namespace - The Amazon CloudWatch namespace of the metric to fetch.
        metric - The CloudWatch metric that to retrieve data points for.
        period - The granularity of returned metric values (in seconds). The statistics function will aggregate metric values with this level of granularity. Must be at least 60 seconds and must be a multiple of 60.
        dimensions - The dimensions (key-value pairs) used to narrow down the result set. Only data points matching the specified dimensions will be returned.
        queryInterval - The time interval for the query. Only Datapoints whose time stamp lies within this interval will be returned. May be null.
        statistic - The aggregation method(s) to apply to metric values. Can be any of "Sum", "Average", "Minimum", "Maximum" and "SampleCount". The returned Datapoints will contain one value for each specified statistic.
    • Method Detail

      • call

        public com.amazonaws.services.cloudwatch.model.GetMetricStatisticsResult call()
                                                                               throws java.lang.Exception
        Specified by:
        call in interface java.util.concurrent.Callable<com.amazonaws.services.cloudwatch.model.GetMetricStatisticsResult>
        Throws:
        java.lang.Exception