class WavefrontCli::Spy

Spy on metrics being ingested into Wavefront

Public Instance Methods

display_class() click to toggle source
# File lib/wavefront-cli/spy.rb, line 39
def display_class
  'WavefrontDisplay::Spy'
end
do_histograms() click to toggle source
# File lib/wavefront-cli/spy.rb, line 18
def do_histograms
  wf.histograms(rate, fn_args, fn_opts)
end
do_ids() click to toggle source
# File lib/wavefront-cli/spy.rb, line 26
def do_ids
  wf.ids(rate,
         { prefix: options[:prefix], type: options[:type] },
         fn_opts)
end
do_points() click to toggle source
# File lib/wavefront-cli/spy.rb, line 14
def do_points
  wf.points(rate, fn_args, fn_opts)
end
do_spans() click to toggle source
# File lib/wavefront-cli/spy.rb, line 22
def do_spans
  wf.spans(rate, fn_args, fn_opts)
end
key_opts() click to toggle source

Passing an empty array to the Spy methods sets up a filter for things with an empty tag key. So we won't.

# File lib/wavefront-cli/spy.rb, line 35
def key_opts
  options[:tagkey].empty? ? nil : options[:tagkey]
end
no_api_response() click to toggle source
# File lib/wavefront-cli/spy.rb, line 10
def no_api_response
  %w[do_points do_histograms do_spans do_ids]
end

Private Instance Methods

fn_args() click to toggle source
# File lib/wavefront-cli/spy.rb, line 51
def fn_args
  { prefix: options[:prefix],
    host: options[:host],
    tag_key: key_opts }
end
fn_opts() click to toggle source
# File lib/wavefront-cli/spy.rb, line 57
def fn_opts
  { timestamp_chunks: options[:timestamp],
    timeout: options[:endafter].to_i }
end
rate() click to toggle source
# File lib/wavefront-cli/spy.rb, line 45
def rate
  return 0.01 unless options[:rate]

  options[:rate].to_f
end