Class: Wavefront::Response::Graphite

Inherits:
Ruby
  • Object
show all
Defined in:
lib/wavefront/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Graphite

Returns a new instance of Graphite.



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/wavefront/response.rb', line 54

def initialize(response)
  super
  
  datapoints = Array.new
  self.timeseries.each do |ts|
    ts['data'].each do |d|
      datapoints << [d[1], d[0]]
    end
  end

  @graphite = [{ 'target' => self.query, 'datapoints' => datapoints }]
end

Instance Attribute Details

#graphiteObject (readonly)

Returns the value of attribute graphite.



52
53
54
# File 'lib/wavefront/response.rb', line 52

def graphite
  @graphite
end

#responseObject (readonly)

Returns the value of attribute response.



52
53
54
# File 'lib/wavefront/response.rb', line 52

def response
  @response
end