Class: Instana::Backend::HostAgentLookup

Inherits:
Object
  • Object
show all
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.

Since:

  • 1.197.0

Instance Method Summary collapse

Constructor Details

#initialize(host = ::Instana.config[:agent_host], port = ::Instana.config[:agent_port], destination: '00000000') ⇒ HostAgentLookup

Returns a new instance of HostAgentLookup.

Since:

  • 1.197.0



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

#callRequestClient, NilClass

Returns the request client to use to communicate with the agent or nil if no agent could be found.

Returns:

  • (RequestClient, NilClass)

    the request client to use to communicate with the agent or nil if no agent could be found

Since:

  • 1.197.0



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