Class: WavefrontDisplay::Metric
- Defined in:
- lib/wavefront-cli/display/metric.rb
Overview
Format human-readable output for metrics.
Constant Summary
Constants included from WavefrontCli::Constants
WavefrontCli::Constants::DEFAULT_OPTS, WavefrontCli::Constants::HUMAN_TIME_FORMAT, WavefrontCli::Constants::HUMAN_TIME_FORMAT_MS
Instance Attribute Summary
Attributes inherited from Base
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, #put_id_first, #readable_time, #run, #run_error, #run_list, #run_search
Constructor Details
This class inherits a constructor from WavefrontDisplay::Base
Instance Method Details
#do_describe ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/wavefront-cli/display/metric.rb', line 8 def do_describe if data.empty? || data.hosts.empty? puts 'No matches.' exit end @data = data['hosts'].map do |h, _aggr| { host: h[:host], last_update: human_time(h[:last_update]) } end.sort_by { |h| h[:last_update] }.reverse multicolumn(:host, :last_update) end |