Class: OpenTsdb::DataPoint
- Inherits:
-
Object
- Object
- OpenTsdb::DataPoint
- Defined in:
- lib/psc/opentsdb.rb
Instance Attribute Summary collapse
-
#metric ⇒ Object
Returns the value of attribute metric.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(metric, timestamp, value, tags) ⇒ DataPoint
constructor
A new instance of DataPoint.
- #to_hash ⇒ Object
Constructor Details
#initialize(metric, timestamp, value, tags) ⇒ DataPoint
Returns a new instance of DataPoint.
61 62 63 64 65 66 67 68 |
# File 'lib/psc/opentsdb.rb', line 61 def initialize(metric,,value,) @metric = metric #DateTime @timestamp = .to_time.to_i @value = value #Array of Tags @tags = end |
Instance Attribute Details
#metric ⇒ Object
Returns the value of attribute metric.
60 61 62 |
# File 'lib/psc/opentsdb.rb', line 60 def metric @metric end |
#tags ⇒ Object
Returns the value of attribute tags.
60 61 62 |
# File 'lib/psc/opentsdb.rb', line 60 def @tags end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
60 61 62 |
# File 'lib/psc/opentsdb.rb', line 60 def @timestamp end |
#value ⇒ Object
Returns the value of attribute value.
60 61 62 |
# File 'lib/psc/opentsdb.rb', line 60 def value @value end |
Instance Method Details
#to_hash ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/psc/opentsdb.rb', line 70 def to_hash h = {} h[:metric] = @metric h[:timestamp] = @timestamp h[:value] = @value h[:tags] = {} .each do |tag| h[:tags][tag.tag_name] = tag.tag_value end h end |