Class: Stackify::Metrics::MetricAggregate

Inherits:
Object
  • Object
show all
Defined in:
lib/stackify/metrics/metric_aggregate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metric) ⇒ MetricAggregate

Returns a new instance of MetricAggregate.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/stackify/metrics/metric_aggregate.rb', line 7

def initialize metric
  @name = metric.name
  @category = metric.category
  @metric_type = metric.metric_type
  @value = 0
  @count = 0
  @occurred_utc = metric.get_rounded_time
  @name_key = metric.calc_name_key
  @sent = false
  @is_increment = metric.is_increment
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



4
5
6
# File 'lib/stackify/metrics/metric_aggregate.rb', line 4

def category
  @category
end

#countObject

Returns the value of attribute count.



4
5
6
# File 'lib/stackify/metrics/metric_aggregate.rb', line 4

def count
  @count
end

#is_incrementObject

Returns the value of attribute is_increment.



4
5
6
# File 'lib/stackify/metrics/metric_aggregate.rb', line 4

def is_increment
  @is_increment
end

#metric_typeObject

Returns the value of attribute metric_type.



4
5
6
# File 'lib/stackify/metrics/metric_aggregate.rb', line 4

def metric_type
  @metric_type
end

#monitor_idObject

Returns the value of attribute monitor_id.



4
5
6
# File 'lib/stackify/metrics/metric_aggregate.rb', line 4

def monitor_id
  @monitor_id
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/stackify/metrics/metric_aggregate.rb', line 4

def name
  @name
end

#name_keyObject

Returns the value of attribute name_key.



4
5
6
# File 'lib/stackify/metrics/metric_aggregate.rb', line 4

def name_key
  @name_key
end

#occurred_utcObject

Returns the value of attribute occurred_utc.



4
5
6
# File 'lib/stackify/metrics/metric_aggregate.rb', line 4

def occurred_utc
  @occurred_utc
end

#sentObject

Returns the value of attribute sent.



4
5
6
# File 'lib/stackify/metrics/metric_aggregate.rb', line 4

def sent
  @sent
end

#valueObject

Returns the value of attribute value.



4
5
6
# File 'lib/stackify/metrics/metric_aggregate.rb', line 4

def value
  @value
end

Instance Method Details

#aggregate_keyObject



19
20
21
22
# File 'lib/stackify/metrics/metric_aggregate.rb', line 19

def aggregate_key
  (@category || 'Missing Category').downcase + '-' + (@name || 'Missing Name').downcase +
  '-' + @metric_type.to_s + '-' + @occurred_utc.to_s
end