Class: WavefrontCli::Query
- Includes:
- Wavefront::Mixins
- Defined in:
- lib/wavefront-cli/query.rb
Overview
CLI coverage for the v2 ‘query’ API.
Constant Summary
Constants included from Constants
Constants::ALL_PAGE_SIZE, Constants::DEFAULT_OPTS, Constants::HUMAN_TIME_FORMAT, Constants::HUMAN_TIME_FORMAT_MS
Instance Attribute Summary collapse
-
#query_string ⇒ Object
readonly
Returns the value of attribute query_string.
Attributes inherited from Base
#klass, #klass_word, #options, #wf
Instance Method Summary collapse
- #do_aliases ⇒ Object
- #do_default ⇒ Object
- #do_raw ⇒ Object
- #do_run ⇒ Object
- #no_api_response ⇒ Object
Methods inherited from Base
#_sdk_class, #check_status, #conds_to_query, #dispatch, #display, #display_api_error, #display_no_api_response, #do_delete, #do_describe, #do_import, #do_list, #do_search, #do_tag_add, #do_tag_clear, #do_tag_delete, #do_tag_set, #do_tags, #do_undelete, #do_update, #format_var, #handle_error, #handle_response, #hcl_fields, #import_to_create, #initialize, #load_display_class, #load_file, #load_from_stdin, #mk_creds, #mk_opts, #ok_exit, #options_and_exit, #parseable_output, #range_hash, #run, #search_key, #validate_id, #validate_input, #validate_opts, #validate_tags, #validator_exception, #validator_method
Constructor Details
This class inherits a constructor from WavefrontCli::Base
Instance Attribute Details
#query_string ⇒ Object (readonly)
Returns the value of attribute query_string.
9 10 11 |
# File 'lib/wavefront-cli/query.rb', line 9 def query_string @query_string end |
Instance Method Details
#do_aliases ⇒ Object
46 47 48 |
# File 'lib/wavefront-cli/query.rb', line 46 def do_aliases all_aliases end |
#do_default ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/wavefront-cli/query.rb', line 17 def do_default qs = query_string || [:'<query>'] t_start = window_start t_end = window_end granularity = granularity(t_start, t_end) t_end = nil unless [:end] wf.query(qs, granularity, t_start, t_end, q_opts) end |
#do_raw ⇒ Object
28 29 30 31 |
# File 'lib/wavefront-cli/query.rb', line 28 def do_raw wf.raw([:'<metric>'], [:host], [:start], [:end]) end |
#do_run ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/wavefront-cli/query.rb', line 33 def do_run alias_key = format('q_%s', [:'<alias>']).to_sym query = all_aliases.fetch(alias_key, nil) unless query abort "Query not found. 'wf query aliases' will show all " \ 'aliased queries.' end @query_string = query do_default end |
#no_api_response ⇒ Object
13 14 15 |
# File 'lib/wavefront-cli/query.rb', line 13 def no_api_response %w[do_aliases] end |