lib/instana/agent.rb in instana-1.5.0 vs lib/instana/agent.rb in instana-1.5.1
- old
+ new
@@ -61,11 +61,11 @@
# Used post fork to re-initialize state and restart communications with
# the host agent.
#
def after_fork
- ::Instana.logger.agent "after_fork hook called. Falling back to unannounced state and spawning a new background agent thread."
+ ::Instana.logger.debug "after_fork hook called. Falling back to unannounced state and spawning a new background agent thread."
# Reseed the random number generator for this
# new thread.
srand
@@ -168,11 +168,11 @@
# Collect process ID, name and arguments to notify
# the host agent.
#
def announce_sensor
unless @discovered
- ::Instana.logger.agent("#{__method__} called but discovery hasn't run yet!")
+ ::Instana.logger.debug("#{__method__} called but discovery hasn't run yet!")
return false
end
# Always re-collect process info before announce in case the process name has been
# re-written (looking at you puma!)
@@ -193,11 +193,11 @@
uri = URI.parse("http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{DISCOVERY_PATH}")
req = Net::HTTP::Put.new(uri)
req.body = announce_payload.to_json
- ::Instana.logger.agent "Announce: http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{DISCOVERY_PATH} - payload: #{req.body}"
+ ::Instana.logger.debug "Announce: http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{DISCOVERY_PATH} - payload: #{req.body}"
response = make_host_agent_request(req)
if response && (response.code.to_i == 200)
data = JSON.parse(response.body)
@@ -221,11 +221,11 @@
#
# @return [Boolean] true on success, false otherwise
#
def report_metrics(payload)
unless @discovered
- ::Instana.logger.agent("#{__method__} called but discovery hasn't run yet!")
+ ::Instana.logger.debug("#{__method__} called but discovery hasn't run yet!")
return false
end
path = "com.instana.plugin.ruby.#{@process[:report_pid]}"
uri = URI.parse("http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{path}")
@@ -273,11 +273,11 @@
path = "com.instana.plugin.ruby/response.#{@process[:report_pid]}?messageId=#{URI.encode(their_request['messageId'])}"
uri = URI.parse("http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{path}")
req = Net::HTTP::Post.new(uri)
req.body = payload.to_json
- ::Instana.logger.agent_response "Responding to agent: #{req.inspect}"
+ ::Instana.logger.debug "Responding to agent request: #{req.inspect}"
make_host_agent_request(req)
end
# Accept and report spans to the host agent.
#
@@ -286,11 +286,11 @@
#
def report_spans(spans)
return unless @state == :announced
unless @discovered
- ::Instana.logger.agent("#{__method__} called but discovery hasn't run yet!")
+ ::Instana.logger.debug("#{__method__} called but discovery hasn't run yet!")
return false
end
path = "com.instana.plugin.ruby/traces.#{@process[:report_pid]}"
uri = URI.parse("http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{path}")
@@ -395,11 +395,11 @@
def ready?
# In test, we're always ready :-)
return true if ENV['INSTANA_GEM_TEST']
if forked?
- ::Instana.logger.agent "Instana: detected fork. Calling after_fork"
+ ::Instana.logger.debug "Instana: detected fork. Calling after_fork"
after_fork
end
@state == :announced
rescue => e
@@ -415,11 +415,11 @@
#
# @param state [Symbol] Can be 1 of 2 possible states:
# `:announced`, `:unannounced`
#
def transition_to(state)
- ::Instana.logger.agent("Transitioning to #{state}")
+ ::Instana.logger.debug("Transitioning to #{state}")
case state
when :announced
# announce successful; set state
@state = :announced
@@ -454,10 +454,10 @@
@httpclient.open_timeout = 1
@httpclient.read_timeout = 1
end
response = @httpclient.request(req)
- ::Instana.logger.agent_comm "#{req.method}->#{req.uri} body:(#{req.body}) Response:#{response} body:(#{response.body})"
+ # ::Instana.logger.debug "#{req.method}->#{req.uri} body:(#{req.body}) Response:#{response} body:(#{response.body})"
response
rescue Errno::ECONNREFUSED
return nil
rescue => e