Class: SimpleMetrics::DataPoint::Base
- Inherits:
-
Object
- Object
- SimpleMetrics::DataPoint::Base
- Defined in:
- lib/simple_metrics/data_point/base.rb
Instance Attribute Summary (collapse)
-
- (Object) id
readonly
Returns the value of attribute id.
-
- (Object) name
Returns the value of attribute name.
-
- (Object) sum
Returns the value of attribute sum.
-
- (Object) total
Returns the value of attribute total.
-
- (Object) ts
Returns the value of attribute ts.
-
- (Object) type
Returns the value of attribute type.
-
- (Object) value
Returns the value of attribute value.
Instance Method Summary (collapse)
- - (Object) attributes
- - (Boolean) counter?
- - (Boolean) event?
- - (Boolean) gauge?
-
- (Base) initialize(attributes)
constructor
A new instance of Base.
- - (Object) timestamp
- - (Boolean) timing?
- - (Object) to_s
Constructor Details
- (Base) initialize(attributes)
A new instance of Base
9 10 11 12 13 14 15 16 17 |
# File 'lib/simple_metrics/data_point/base.rb', line 9 def initialize(attributes) @id = attributes[:id] @name = attributes[:name] @value = attributes[:value] @ts = attributes[:ts] @sample_rate = attributes[:sample_rate] @sum = attributes[:sum] @total = attributes[:total] end |
Instance Attribute Details
- (Object) id (readonly)
Returns the value of attribute id
7 8 9 |
# File 'lib/simple_metrics/data_point/base.rb', line 7 def id @id end |
- (Object) name
Returns the value of attribute name
6 7 8 |
# File 'lib/simple_metrics/data_point/base.rb', line 6 def name @name end |
- (Object) sum
Returns the value of attribute sum
6 7 8 |
# File 'lib/simple_metrics/data_point/base.rb', line 6 def sum @sum end |
- (Object) total
Returns the value of attribute total
6 7 8 |
# File 'lib/simple_metrics/data_point/base.rb', line 6 def total @total end |
- (Object) ts
Returns the value of attribute ts
6 7 8 |
# File 'lib/simple_metrics/data_point/base.rb', line 6 def ts @ts end |
- (Object) type
Returns the value of attribute type
6 7 8 |
# File 'lib/simple_metrics/data_point/base.rb', line 6 def type @type end |
- (Object) value
Returns the value of attribute value
6 7 8 |
# File 'lib/simple_metrics/data_point/base.rb', line 6 def value @value end |
Instance Method Details
- (Object) attributes
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/simple_metrics/data_point/base.rb', line 43 def attributes { :name => @name, :value => @value, :ts => @ts, :type => @type, :total => @total, :sum => @sum } end |
- (Boolean) counter?
19 20 21 |
# File 'lib/simple_metrics/data_point/base.rb', line 19 def counter? @type == 'c' end |
- (Boolean) event?
31 32 33 |
# File 'lib/simple_metrics/data_point/base.rb', line 31 def event? @type == 'ev' end |
- (Boolean) gauge?
23 24 25 |
# File 'lib/simple_metrics/data_point/base.rb', line 23 def gauge? @type == 'g' end |
- (Object) timestamp
35 36 37 |
# File 'lib/simple_metrics/data_point/base.rb', line 35 def ts end |
- (Boolean) timing?
27 28 29 |
# File 'lib/simple_metrics/data_point/base.rb', line 27 def timing? @type == 'ms' end |
- (Object) to_s
54 55 56 |
# File 'lib/simple_metrics/data_point/base.rb', line 54 def to_s attributes.to_s end |