Class: Lbrt::Metric

Inherits:
Object
  • Object
show all
Includes:
Logger::Helper
Defined in:
lib/lbrt/metric.rb

Instance Method Summary collapse

Methods included from Logger::Helper

#log

Constructor Details

#initialize(client, options = {}) ⇒ Metric

Returns a new instance of Metric.



4
5
6
7
# File 'lib/lbrt/metric.rb', line 4

def initialize(client, options = {})
  @client = client
  @options = options
end

Instance Method Details

#listObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/lbrt/metric.rb', line 9

def list
  json = {}
  metric_names = build_metric_names

  metric_names.each do |name|
    json[name] = {
      url: metric_url(name),
    }
  end

  puts JSON.pretty_generate(json)
end

#pecoObject



22
23
24
25
26
27
28
29
30
# File 'lib/lbrt/metric.rb', line 22

def peco
  metric_names = build_metric_names
  result = PecoSelector.select_from(metric_names)

  result.each do |name|
    url = metric_url(name)
    Lbrt::Utils.open(url)
  end
end