Class: AWS::CloudWatch::MetricStatistics
- Inherits:
-
Object
- Object
- AWS::CloudWatch::MetricStatistics
- Includes:
- AWS::Core::Collection::Simple
- Defined in:
- lib/aws/cloud_watch/metric_statistics.rb
Overview
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
Instance Attribute Summary collapse
- #datapoints ⇒ Array<Hash> readonly
- #label ⇒ String readonly
- #metric ⇒ Metric readonly
Instance Method Summary collapse
-
#initialize(metric, label, datapoints) ⇒ MetricStatistics
constructor
A new instance of MetricStatistics.
Methods included from AWS::Core::Collection
#each, #each_batch, #enum, #first, #in_groups_of, #page
Constructor Details
#initialize(metric, label, datapoints) ⇒ MetricStatistics
Returns a new instance of MetricStatistics.
44 45 46 47 48 |
# File 'lib/aws/cloud_watch/metric_statistics.rb', line 44 def initialize metric, label, datapoints @metric = metric @label = label @datapoints = datapoints end |
Instance Attribute Details
#datapoints ⇒ Array<Hash> (readonly)
57 58 59 |
# File 'lib/aws/cloud_watch/metric_statistics.rb', line 57 def datapoints @datapoints end |
#label ⇒ String (readonly)
54 55 56 |
# File 'lib/aws/cloud_watch/metric_statistics.rb', line 54 def label @label end |
#metric ⇒ Metric (readonly)
51 52 53 |
# File 'lib/aws/cloud_watch/metric_statistics.rb', line 51 def metric @metric end |