Class: Wavefront::Response::Graphite
- Includes:
- Mixins
- Defined in:
- lib/wavefront/response.rb
Instance Attribute Summary collapse
-
#graphite ⇒ Object
readonly
Returns the value of attribute graphite.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response, options = {}) ⇒ Graphite
constructor
A new instance of Graphite.
Methods included from Mixins
#call_delete, #call_get, #call_post, #hash_to_qs, #interpolate_schema, #load_file, #parse_time, #time_to_ms, #uri_concat
Constructor Details
#initialize(response, options = {}) ⇒ Graphite
Returns a new instance of Graphite.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/wavefront/response.rb', line 59 def initialize(response, ={}) super [:prefix_length] ||= Wavefront::Client::DEFAULT_PREFIX_LENGTH @graphite = Array.new self.timeseries.each do |ts| output_timeseries = Hash.new output_timeseries['target'] = interpolate_schema(ts['label'], ts['host'], [:prefix_length]) datapoints = Array.new ts['data'].each do |d| datapoints << [d[1], d[0]] end output_timeseries['datapoints'] = datapoints @graphite << output_timeseries end end |
Instance Attribute Details
#graphite ⇒ Object (readonly)
Returns the value of attribute graphite.
57 58 59 |
# File 'lib/wavefront/response.rb', line 57 def graphite @graphite end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
57 58 59 |
# File 'lib/wavefront/response.rb', line 57 def @options end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
57 58 59 |
# File 'lib/wavefront/response.rb', line 57 def response @response end |