Class CloudWatchMetricStreamDefinition

    • Constructor Summary

      Constructors 
      Constructor Description
      CloudWatchMetricStreamDefinition​(java.lang.String id, java.lang.String namespace, java.lang.String metric, CloudWatchStatistic statistic, com.elastisys.scale.commons.json.types.TimeInterval period, java.lang.Boolean convertToRate, java.util.Map<java.lang.String,​java.lang.String> dimensions, com.elastisys.scale.commons.json.types.TimeInterval dataSettlingTime, com.elastisys.scale.commons.json.types.TimeInterval queryChunkSize)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      com.elastisys.scale.commons.json.types.TimeInterval getDataSettlingTime()
      Returns the minimum age of requested data points.
      java.util.Map<java.lang.String,​java.lang.String> getDimensions()
      Returns the dimensions (key-value pairs) used to narrow down the set of streamed metric values.
      java.lang.String getId()
      Returns the id of the metric stream.
      java.lang.String getMetric()
      Returns the CloudWatch metric that the metric stream retrieves MetricValues for.
      java.lang.String getNamespace()
      Returns the Amazon CloudWatch namespace of the metric to fetch.
      com.elastisys.scale.commons.json.types.TimeInterval getPeriod()
      Returns Specifies the time period over which to apply the statistic and, hence, the spacing between data points in the aggregated data.
      com.elastisys.scale.commons.json.types.TimeInterval getQueryChunkSize()
      The maximum time period that a single query will attempt to fetch in a single call.
      CloudWatchStatistic getStatistic()
      Returns the aggregation method to apply to the set of metric values.
      int hashCode()  
      boolean isConvertToRate()
      When true the stream will feed the change rate of the metric rather than the absolute values of the metric.
      java.lang.String toString()  
      void validate()
      Validates that this CloudWatchMetricStreamDefinition contains sufficient information to allow a valid AWS CloudWatch query to be built.
      CloudWatchMetricStreamDefinition withPeriod​(com.elastisys.scale.commons.json.types.TimeInterval period)
      Creates a field-by-field copy of this object with the period field substituted in the returned clone.
      CloudWatchMetricStreamDefinition withStatistic​(CloudWatchStatistic statistic)
      Creates a field-by-field copy of this object with the statistic field substituted in the returned clone.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • CLOUDWATCH_MAX_DATA_POINTS

        public static final long CLOUDWATCH_MAX_DATA_POINTS
        The maximum number of data points that can be requested in a single call to the CloudWatch API.
        See Also:
        Constant Field Values
      • DEFAULT_RATE_CONVERSION

        public static final java.lang.Boolean DEFAULT_RATE_CONVERSION
    • Constructor Detail

      • CloudWatchMetricStreamDefinition

        public CloudWatchMetricStreamDefinition​(java.lang.String id,
                                                java.lang.String namespace,
                                                java.lang.String metric,
                                                CloudWatchStatistic statistic,
                                                com.elastisys.scale.commons.json.types.TimeInterval period,
                                                java.lang.Boolean convertToRate,
                                                java.util.Map<java.lang.String,​java.lang.String> dimensions,
                                                com.elastisys.scale.commons.json.types.TimeInterval dataSettlingTime,
                                                com.elastisys.scale.commons.json.types.TimeInterval queryChunkSize)
        Constructs a new CloudWatchMetricStreamDefinition.

        See the CloudWatch concepts for an explanation of the parameters.

        Parameters:
        id - The id of the metric stream. This is the id that will be used by clients wishing to subscribe to MetricValues for this metric stream. Required.
        namespace - The Amazon CloudWatch namespace of the metric to fetch. Required.
        metric - The CloudWatch metric that the metric stream retrieves MetricValues for. Required.
        statistic - The aggregation method to apply to the set of metric values. Can be any of "Sum", "Average", "Minimum", "Maximum" and "SampleCount". Required.
        period - Specifies the time period over which to apply the statistic and, hence, the spacing between data points in the aggregated data. Must be at least 60 seconds and must be a multiple of 60. Required.
        convertToRate - When true the stream will feed the change rate of the metric rather than the absolute values of the metric.
        dimensions - The dimensions (key-value pairs) used to narrow down the set of streamed metric values. Only metric values matching the specified dimensions will be returned.

        As an example, for EC2 instance metrics (namespace @code ), InstanceId can be used to only return values for a certain instance and AutoScalingGroupName to narrow down queries to only ask for metrics from a certain Auto Scaling Group. May be null.

        dataSettlingTime - The minimum age of requested data points. The MetricStreamer will never request values newer than this from CloudWatch. As such, this value can be regarded as the expected "settling time" of new data points.

        When requesting aggregate metric data points from CloudWatch that are recent, there is always a risk of seeing partial/incomplete results before metric values from all instances have been registered. Typically, it takes a couple of minutes for all instances to report their values to CloudWatch.

        May be null. Default is to use no data settling time.

        queryChunkSize - The maximum time period that a single query will attempt to fetch in a single call. A query with a longer time interval will be run incrementally, each fetching a sub-interval of this duration. This type of incremental retrieval of large QueryResultSets limits the amount of (memory) resources involved in processing large queries. May be null. Default: #MAX_QUERY_CHUNK_SIZE
    • Method Detail

      • getId

        public java.lang.String getId()
        Returns the id of the metric stream. This is the id that will be used by clients wishing to subscribe to MetricValues for this metric stream.
        Returns:
      • getNamespace

        public java.lang.String getNamespace()
        Returns the Amazon CloudWatch namespace of the metric to fetch.
        Returns:
      • getMetric

        public java.lang.String getMetric()
        Returns the CloudWatch metric that the metric stream retrieves MetricValues for.
        Returns:
      • getDimensions

        public java.util.Map<java.lang.String,​java.lang.String> getDimensions()
        Returns the dimensions (key-value pairs) used to narrow down the set of streamed metric values. Only metric values matching the specified dimensions will be returned.

        As an example, for EC2 instance metrics (namespace @code ), InstanceId can be used to only return values for a certain instance and AutoScalingGroupName to narrow down queries to only ask for metrics from a certain Auto Scaling Group.

        Returns:
      • getStatistic

        public CloudWatchStatistic getStatistic()
        Returns the aggregation method to apply to the set of metric values. Can be any of "Sum", "Average", "Minimum", "Maximum" and "SampleCount".
        Returns:
      • getPeriod

        public com.elastisys.scale.commons.json.types.TimeInterval getPeriod()
        Returns Specifies the time period over which to apply the statistic and, hence, the spacing between data points in the aggregated data. Must be at least 60 seconds and must be a multiple of 60.
        Returns:
      • isConvertToRate

        public boolean isConvertToRate()
        When true the stream will feed the change rate of the metric rather than the absolute values of the metric.
        Returns:
      • getDataSettlingTime

        public com.elastisys.scale.commons.json.types.TimeInterval getDataSettlingTime()
        Returns the minimum age of requested data points. The MetricStreamer will never request values newer than this from CloudWatch. As such, this value can be regarded as the expected "settling time" of new data points.

        When requesting aggregate metric data points from CloudWatch that are recent, there is always a risk of seeing partial/incomplete results before metric values from all instances have been registered. Typically, it takes a couple of minutes for all instances to report their values to CloudWatch.

        Returns:
      • getQueryChunkSize

        public com.elastisys.scale.commons.json.types.TimeInterval getQueryChunkSize()
        The maximum time period that a single query will attempt to fetch in a single call. A query with a longer time interval will be run incrementally, each fetching a sub-interval of this duration. This type of incremental retrieval of large QueryResultSets limits the amount of (memory) resources involved in processing large queries.
        Returns:
      • validate

        public void validate()
                      throws java.lang.IllegalArgumentException
        Validates that this CloudWatchMetricStreamDefinition contains sufficient information to allow a valid AWS CloudWatch query to be built. If it does, the method will just return. If it is found to be invalid, a IllegalArgumentException is thrown.
        Throws:
        java.lang.IllegalArgumentException - If this CloudWatchMetricStreamDefinition is invalid.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • withPeriod

        public CloudWatchMetricStreamDefinition withPeriod​(com.elastisys.scale.commons.json.types.TimeInterval period)
        Creates a field-by-field copy of this object with the period field substituted in the returned clone.
        Parameters:
        period -
        Returns: