Class: QueryParam

Inherits:
Object
  • Object
show all
Defined in:
lib/opentsdb/query_param.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ QueryParam



6
7
8
9
10
11
# File 'lib/opentsdb/query_param.rb', line 6

def initialize(options = {})
  @aggregator = options[:aggregator]
  @rate       = options[:rate] || false
  @metric     = options[:metric]
  @tags       = options[:tags] || {}
end

Instance Attribute Details

#aggregatorObject

Returns the value of attribute aggregator.



3
4
5
# File 'lib/opentsdb/query_param.rb', line 3

def aggregator
  @aggregator
end

#downsampleObject

Returns the value of attribute downsample.



3
4
5
# File 'lib/opentsdb/query_param.rb', line 3

def downsample
  @downsample
end

#end_timeObject

Returns the value of attribute end_time.



4
5
6
# File 'lib/opentsdb/query_param.rb', line 4

def end_time
  @end_time
end

#intervalObject

Returns the value of attribute interval.



3
4
5
# File 'lib/opentsdb/query_param.rb', line 3

def interval
  @interval
end

#metricObject

Returns the value of attribute metric.



3
4
5
# File 'lib/opentsdb/query_param.rb', line 3

def metric
  @metric
end

#queries=(value) ⇒ Object

Sets the attribute queries



4
5
6
# File 'lib/opentsdb/query_param.rb', line 4

def queries=(value)
  @queries = value
end

#rateObject

Returns the value of attribute rate.



3
4
5
# File 'lib/opentsdb/query_param.rb', line 3

def rate
  @rate
end

#start_timeObject

Returns the value of attribute start_time.



4
5
6
# File 'lib/opentsdb/query_param.rb', line 4

def start_time
  @start_time
end

#tagsObject

Returns the value of attribute tags.



3
4
5
# File 'lib/opentsdb/query_param.rb', line 3

def tags
  @tags
end

Instance Method Details

#to_jsonObject



21
22
23
24
25
26
27
# File 'lib/opentsdb/query_param.rb', line 21

def to_json
  {}.tap do |h|
    h[:start]   = start_time
    h[:end]     = end_time
    h[:queries] = queries
  end.to_json
end