Module: TingYun::Support::CollectorMethods

Included in:
TingYun::Support
Defined in:
lib/ting_yun/support/collector.rb

Instance Method Summary collapse

Instance Method Details

#api_collectorObject



16
17
18
# File 'lib/ting_yun/support/collector.rb', line 16

def api_collector
  @api_collector ||= Collector.new(TingYun::Agent.config[:api_host], TingYun::Agent.config[:api_port])
end

#collectorObject



12
13
14
# File 'lib/ting_yun/support/collector.rb', line 12

def collector
  @remote_collector ||= collector_from_host
end

#collector_from_host(hostname = nil) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/ting_yun/support/collector.rb', line 20

def collector_from_host(hostname=nil)
  if hostname.nil?
    Collector.new(TingYun::Agent.config[:host], TingYun::Agent.config[:port])
  else
    args = hostname.split(':')
    Collector.new(args[0], args[1]||TingYun::Agent.config[:port])
  end

end