Class: Opentsdb::QueryParam
- Inherits:
-
Object
- Object
- Opentsdb::QueryParam
- Defined in:
- lib/opentsdb/query_param.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#aggregator ⇒ Object
Returns the value of attribute aggregator.
-
#downsample ⇒ Object
Returns the value of attribute downsample.
-
#end_time ⇒ Object
Returns the value of attribute end_time.
-
#excluding_tags ⇒ Object
Returns the value of attribute excluding_tags.
-
#group ⇒ Object
Returns the value of attribute group.
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#metric ⇒ Object
Returns the value of attribute metric.
-
#rate ⇒ Object
Returns the value of attribute rate.
-
#rate_options ⇒ Object
Returns the value of attribute rate_options.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
-
#tags ⇒ Object
Returns the value of attribute tags.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ QueryParam
constructor
A new instance of QueryParam.
- #to_json ⇒ Object
- #to_query_tags ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ QueryParam
Returns a new instance of QueryParam.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/opentsdb/query_param.rb', line 8 def initialize( = {}) @aggregator = [:aggregator] @rate = [:rate] || false @metric = [:metric] = [:tags] || {} = [:excluding_tags] || {} = [:rate_options] @group = [:group] || [] @start_time = 0 @end_time = 0 end |
Instance Attribute Details
#aggregator ⇒ Object
Returns the value of attribute aggregator.
4 5 6 |
# File 'lib/opentsdb/query_param.rb', line 4 def aggregator @aggregator end |
#downsample ⇒ Object
Returns the value of attribute downsample.
4 5 6 |
# File 'lib/opentsdb/query_param.rb', line 4 def downsample @downsample end |
#end_time ⇒ Object
Returns the value of attribute end_time.
6 7 8 |
# File 'lib/opentsdb/query_param.rb', line 6 def end_time @end_time end |
#excluding_tags ⇒ Object
Returns the value of attribute excluding_tags.
5 6 7 |
# File 'lib/opentsdb/query_param.rb', line 5 def end |
#group ⇒ Object
Returns the value of attribute group.
4 5 6 |
# File 'lib/opentsdb/query_param.rb', line 4 def group @group end |
#interval ⇒ Object
Returns the value of attribute interval.
4 5 6 |
# File 'lib/opentsdb/query_param.rb', line 4 def interval @interval end |
#metric ⇒ Object
Returns the value of attribute metric.
4 5 6 |
# File 'lib/opentsdb/query_param.rb', line 4 def metric @metric end |
#rate ⇒ Object
Returns the value of attribute rate.
4 5 6 |
# File 'lib/opentsdb/query_param.rb', line 4 def rate @rate end |
#rate_options ⇒ Object
Returns the value of attribute rate_options.
4 5 6 |
# File 'lib/opentsdb/query_param.rb', line 4 def end |
#start_time ⇒ Object
Returns the value of attribute start_time.
6 7 8 |
# File 'lib/opentsdb/query_param.rb', line 6 def start_time @start_time end |
#tags ⇒ Object
Returns the value of attribute tags.
4 5 6 |
# File 'lib/opentsdb/query_param.rb', line 4 def end |
Instance Method Details
#to_json ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/opentsdb/query_param.rb', line 28 def to_json {}.tap do |h| h[:start] = start_time h[:end] = end_time h[:queries] = [queries] end.to_json end |
#to_query_tags ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/opentsdb/query_param.rb', line 36 def {}.tap do || .each do |tagk, tagv| [tagk] = tagv.to_a.compact.join('|') if tagv.is_a?(Array) || tagv.is_a?(Set) [tagk] = '*' if tagv.nil? || tagv.empty? end end end |