Class: Stackify::Metrics::Metric
- Defined in:
- lib/stackify/metrics/metric.rb
Instance Attribute Summary collapse
-
#aggregate_key ⇒ Object
Returns the value of attribute aggregate_key.
-
#category ⇒ Object
Returns the value of attribute category.
-
#is_increment ⇒ Object
Returns the value of attribute is_increment.
-
#metric_type ⇒ Object
Returns the value of attribute metric_type.
-
#name ⇒ Object
Returns the value of attribute name.
-
#occurred ⇒ Object
Returns the value of attribute occurred.
-
#settings ⇒ Object
Returns the value of attribute settings.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #calc_and_set_aggregate_key ⇒ Object
- #calc_name_key ⇒ Object
- #get_rounded_time ⇒ Object
-
#initialize(category, name, metric_type, metric_settings = nil) ⇒ Metric
constructor
A new instance of Metric.
Constructor Details
#initialize(category, name, metric_type, metric_settings = nil) ⇒ Metric
Returns a new instance of Metric.
7 8 9 10 11 12 13 14 15 |
# File 'lib/stackify/metrics/metric.rb', line 7 def initialize category, name, metric_type, metric_settings = nil @category = category @name = name @metric_type = metric_type @occurred = Time.now.utc @occurred = get_rounded_time @is_increment = false @settings = metric_settings || MetricSettings.new end |
Instance Attribute Details
#aggregate_key ⇒ Object
Returns the value of attribute aggregate_key.
4 5 6 |
# File 'lib/stackify/metrics/metric.rb', line 4 def aggregate_key @aggregate_key end |
#category ⇒ Object
Returns the value of attribute category.
4 5 6 |
# File 'lib/stackify/metrics/metric.rb', line 4 def category @category end |
#is_increment ⇒ Object
Returns the value of attribute is_increment.
4 5 6 |
# File 'lib/stackify/metrics/metric.rb', line 4 def is_increment @is_increment end |
#metric_type ⇒ Object
Returns the value of attribute metric_type.
4 5 6 |
# File 'lib/stackify/metrics/metric.rb', line 4 def metric_type @metric_type end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/stackify/metrics/metric.rb', line 4 def name @name end |
#occurred ⇒ Object
Returns the value of attribute occurred.
4 5 6 |
# File 'lib/stackify/metrics/metric.rb', line 4 def occurred @occurred end |
#settings ⇒ Object
Returns the value of attribute settings.
4 5 6 |
# File 'lib/stackify/metrics/metric.rb', line 4 def settings @settings end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/stackify/metrics/metric.rb', line 4 def value @value end |
Instance Method Details
#calc_and_set_aggregate_key ⇒ Object
17 18 19 20 |
# File 'lib/stackify/metrics/metric.rb', line 17 def calc_and_set_aggregate_key @aggregate_key = @category.downcase + '-' + (@name || 'Missing Name').downcase + '-' + @metric_type.to_s + '-' + get_rounded_time.to_s end |
#calc_name_key ⇒ Object
22 23 24 |
# File 'lib/stackify/metrics/metric.rb', line 22 def calc_name_key @category.downcase + '-' + (@name || 'Missing Name').downcase + '-' + @metric_type.to_s end |
#get_rounded_time ⇒ Object
26 27 28 |
# File 'lib/stackify/metrics/metric.rb', line 26 def get_rounded_time @occurred - @occurred.sec end |