Module: TingYun::Support::CollectorMethods
- Included in:
- TingYun::Support
- Defined in:
- lib/ting_yun/support/collector.rb
Instance Method Summary collapse
- #api_collector ⇒ Object
- #collector ⇒ Object
- #collector_from_host(hostname = nil) ⇒ Object
- #collectorV3(host) ⇒ Object
- #reset ⇒ Object
Instance Method Details
#api_collector ⇒ Object
19 20 21 |
# File 'lib/ting_yun/support/collector.rb', line 19 def api_collector @api_collector ||= Collector.new(TingYun::Agent.config[:api_host], TingYun::Agent.config[:api_port]) end |
#collector ⇒ Object
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
23 24 25 26 27 28 29 30 |
# File 'lib/ting_yun/support/collector.rb', line 23 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 |
#collectorV3(host) ⇒ Object
15 16 17 |
# File 'lib/ting_yun/support/collector.rb', line 15 def collectorV3(host) @remote_collector ||= collector_from_host(host) end |
#reset ⇒ Object
32 33 34 |
# File 'lib/ting_yun/support/collector.rb', line 32 def reset @remote_collector = nil end |