lib/instana/backend/host_agent.rb in instana-1.199.6 vs lib/instana/backend/host_agent.rb in instana-1.200.0.pre1
- old
+ new
@@ -3,16 +3,17 @@
module Instana
module Backend
# @since 1.197.0
class HostAgent
- attr_reader :future
+ attr_reader :future, :client
def initialize(discovery: Concurrent::Atom.new(nil), logger: ::Instana.logger)
@discovery = discovery
@logger = logger
@future = nil
+ @client = nil
end
def setup; end
def spawn_background_thread
@@ -24,17 +25,17 @@
end
alias start spawn_background_thread
def announce
- client = until_not_nil { HostAgentLookup.new.call }
+ @client = until_not_nil { HostAgentLookup.new.call }
@discovery.delete_observers
@discovery
- .with_observer(HostAgentActivationObserver.new(client, @discovery))
- .with_observer(HostAgentReportingObserver.new(client, @discovery))
+ .with_observer(HostAgentActivationObserver.new(@client, @discovery))
+ .with_observer(HostAgentReportingObserver.new(@client, @discovery))
@discovery.swap { nil }
- client
+ @client
end
alias after_fork announce
# @return [Boolean] true if the agent able to send spans to the backend