class AWS::CloudWatch::MetricStatistics

Statistics for a metric.

This class is an enumerable collection of data points.

## Enumerating Statistics

metric = CloudWatch::Metric.new('my/namepace', 'metric-name')

stats = metric.statistics(
  :start_time => Time.now - 3600,
  :end_time => Time.now,
  :statistics => ['Average'])

stats.label #=> 'some-label'
stats.each do |datapoint|
  # datapoint is a hash
end

@see Core::Collection

Attributes

datapoints[R]

@return [Array<Hash>]

label[R]

@return [String]

metric[R]

@return [Metric]

Public Class Methods

new(metric, label, datapoints) click to toggle source

@param [Metric] metric @param [String] label @param [Array<Hash>] datapoints

# File lib/aws/cloud_watch/metric_statistics.rb, line 44
def initialize metric, label, datapoints
  @metric = metric
  @label = label
  @datapoints = datapoints
end

Protected Instance Methods

_each_item(options = {}) { |point| ... } click to toggle source
# File lib/aws/cloud_watch/metric_statistics.rb, line 61
def _each_item options = {}
  datapoints.each do |point|
    yield(point)
  end
end