Skip to content

Commit

Permalink
add supportability metric for every time the agent connects to the se…
Browse files Browse the repository at this point in the history
…rver
  • Loading branch information
jaggederest committed Apr 29, 2011
1 parent dfdb4f3 commit 4552000
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/new_relic/agent/agent.rb
Expand Up @@ -897,6 +897,7 @@ def remote_method_uri(method)

# send a message via post
def invoke_remote(method, *args)
now = Time.now
#determines whether to zip the data or send plain
post_data, encoding = compress_data(args)

Expand All @@ -910,6 +911,9 @@ def invoke_remote(method, *args)
rescue SystemCallError, SocketError => e
# These include Errno connection errors
raise NewRelic::Agent::ServerConnectionException, "Recoverable error connecting to the server: #{e}"
ensure
NewRelic::Agent.instance.stats_engine.get_stats_no_scope('Supportability/invoke_remote').record_data_point((Time.now - now).to_f)
NewRelic::Agent.instance.stats_engine.get_stats_no_scope('Supportability/invoke_remote/' + method.to_s).record_data_point((Time.now - now).to_f)
end

def graceful_disconnect
Expand Down

0 comments on commit 4552000

Please sign in to comment.