lib/instana/agent.rb in instana-1.9.6 vs lib/instana/agent.rb in instana-1.9.7

- old
+ new

@@ -154,11 +154,11 @@ if !ENV.key?("INSTANA_QUIET") ::Instana.logger.warn "Host agent not available. Will retry periodically. (Set env INSTANA_QUIET=1 to shut these messages off)" end end - loop do + while true if @state == :unannounced @collect_timer.pause @announce_timer.resume else @announce_timer.pause @@ -197,11 +197,11 @@ announce_payload = {} announce_payload[:pid] = pid_namespace? ? get_real_pid : Process.pid announce_payload[:name] = @process[:name] announce_payload[:args] = @process[:arguments] - if @is_linux && !::Instana.test? + if @is_linux && !ENV.key?('INSTANA_TEST') # We create an open socket to the host agent in case we are running in a container # and the real pid needs to be detected. socket = TCPSocket.new @discovered[:agent_host], @discovered[:agent_port] announce_payload[:fd] = socket.fileno announce_payload[:inode] = File.readlink("/proc/#{Process.pid}/fd/#{socket.fileno}") @@ -327,11 +327,11 @@ end end false rescue => e Instana.logger.debug "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" - Instana.logger.debug e.backtrace.join("\r\n") unless ::Instana.test? + Instana.logger.debug e.backtrace.join("\r\n") unless ENV.key?('INSTANA_TEST') return false end # Runs a discovery process to determine where we can contact the host agent. This is usually just # localhost but in docker can be found on the default gateway. Another option is the INSTANA_AGENT_HOST @@ -433,10 +433,10 @@ response rescue Errno::ECONNREFUSED return nil rescue => e Instana.logger.debug "#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" - Instana.logger.debug e.backtrace.join("\r\n") unless ::Instana.test? + Instana.logger.debug e.backtrace.join("\r\n") unless ENV.key?('INSTANA_TEST') return nil end end end