class OpenTsdb::DataPoint

Attributes

metric[RW]
tags[RW]
timestamp[RW]
value[RW]

Public Class Methods

new(metric,timestamp,value,tags) click to toggle source
# File lib/psc/opentsdb.rb, line 61
def initialize(metric,timestamp,value,tags)
  @metric = metric
  #DateTime
  @timestamp = timestamp.to_time.to_i
  @value = value
  #Array of Tags
  @tags = tags
end

Public Instance Methods

to_hash() click to toggle source
# File lib/psc/opentsdb.rb, line 70
def to_hash
  h = {}
  h[:metric] = @metric
  h[:timestamp] = @timestamp
  h[:value] = @value
  h[:tags] = {}
  tags.each do |tag|
    h[:tags][tag.tag_name] = tag.tag_value
  end
  h
end