Class: Instana::Backend::HostAgentLookup
- Inherits:
-
Object
- Object
- Instana::Backend::HostAgentLookup
- Defined in:
- lib/instana/backend/host_agent_lookup.rb
Overview
Utility class to discover the agent that a given instance of the collector needs to communicate with.
Instance Method Summary collapse
-
#call ⇒ RequestClient, NilClass
The request client to use to communicate with the agent or nil if no agent could be found.
-
#initialize(host = ::Instana.config[:agent_host], port = ::Instana.config[:agent_port], destination: '00000000') ⇒ HostAgentLookup
constructor
A new instance of HostAgentLookup.
Constructor Details
#initialize(host = ::Instana.config[:agent_host], port = ::Instana.config[:agent_port], destination: '00000000') ⇒ HostAgentLookup
Returns a new instance of HostAgentLookup.
12 13 14 15 16 |
# File 'lib/instana/backend/host_agent_lookup.rb', line 12 def initialize(host = ::Instana.config[:agent_host], port = ::Instana.config[:agent_port], destination: '00000000') @host = host @port = port @destination = destination end |
Instance Method Details
#call ⇒ RequestClient, NilClass
Returns the request client to use to communicate with the agent or nil if no agent could be found.
19 20 21 |
# File 'lib/instana/backend/host_agent_lookup.rb', line 19 def call host_listening?(@host, @port) || host_listening?(default_gateway, @port) end |