Class: WavefrontDisplay::Query
- Inherits:
-
Base
- Object
- Base
- WavefrontDisplay::Query
show all
- Defined in:
- lib/wavefront-cli/display/query.rb
Overview
Format human-readable output for queries.
Constant Summary
WavefrontCli::Constants::DEFAULT_OPTS, WavefrontCli::Constants::HUMAN_TIME_FORMAT, WavefrontCli::Constants::HUMAN_TIME_FORMAT_MS
Instance Attribute Summary
Attributes inherited from Base
#data, #options, #raw
Instance Method Summary
collapse
Methods inherited from Base
#do_delete, #do_import, #do_list, #do_list_brief, #do_search, #do_search_brief, #do_tag_add, #do_tag_clear, #do_tag_delete, #do_tag_set, #do_tags, #do_undelete, #drop_fields, #friendly_name, #human_time, #initialize, #key_width, #long_output, #multicolumn, #pagination_line, #put_id_first, #readable_time, #readable_time_arr, #run, #run_error, #run_list, #run_search
Instance Method Details
#do_aliases ⇒ Object
44
45
46
47
48
49
50
|
# File 'lib/wavefront-cli/display/query.rb', line 44
def do_aliases
if data.empty?
puts 'No aliases defined.'
else
data.each { |k, _v| puts k.to_s[2..-1] }
end
end
|
#do_default ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/wavefront-cli/display/query.rb', line 8
def do_default
ts = if data.key?(:timeseries)
data[:timeseries].each do |s|
s[:data] = humanize_series(s[:data])
end
else
[]
end
events = if data.key?(:events)
data[:events].map { |s| humanize_event(s) }
else
[]
end
new = { name: data.name,
query: data.query,
timeseries: ts,
events: events }
@data = new
long_output
end
|
#do_raw ⇒ Object
36
37
38
|
# File 'lib/wavefront-cli/display/query.rb', line 36
def do_raw
data.each { |ts| puts humanize_series(ts[:points]).join("\n") }
end
|
#do_raw_404 ⇒ Object
40
41
42
|
# File 'lib/wavefront-cli/display/query.rb', line 40
def do_raw_404
puts 'API 404: metric does not exist.'
end
|
#do_run ⇒ Object
32
33
34
|
# File 'lib/wavefront-cli/display/query.rb', line 32
def do_run
do_default
end
|