Sha256: f62db1e8065b86bada593dcb10be99727e2a47bf14f76bc53878382b28367ecf

Contents?: true

Size: 622 Bytes

Versions: 2

Compression:

Stored size: 622 Bytes

Contents

# encoding: utf-8

require 'ting_yun/agent'

module TingYun
  module Support
    class Collector <  Struct.new :name, :port
      def to_s; "#{name}:#{port}"; end
    end

    module CollectorMethods
      def collector
        @remote_collector ||= collector_from_host
      end

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

      def collector_from_host(hostname=nil)
        Collector.new(hostname || TingYun::Agent.config[:host], TingYun::Agent.config[:port])
      end

    end

    extend CollectorMethods

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tingyun_rpm-1.0.7 lib/ting_yun/support/collector.rb
tingyun_rpm-1.0.6 lib/ting_yun/support/collector.rb