| Module | NewRelic::Agent::Agent::InstanceMethods::Connect |
| In: |
lib/new_relic/agent/agent.rb
|
This module is an artifact of a refactoring of the connect method - all of its methods are used in that context, so it can be refactored at will. It should be fully tested
| connect_attempts | [RW] | number of attempts we‘ve made to contact the server |
Retry period is a minute for each failed attempt that we‘ve made. This should probably do some sort of sane TCP backoff to prevent hammering the server, but a minute for each attempt seems to work reasonably well.
Initializes the hash of settings that we send to the server. Returns a literal hash containing the options
Checks whether we should send environment info, and if so, returns the snapshot from the local environment. Generating the EnvironmentReport has the potential to trigger require calls in Rails environments, so this method should only be called synchronously from on the main thread.
Takes a hash of configuration data returned from the server and uses it to set local variables and to initialize various parts of the agent that are configured separately.
Can accommodate most arbitrary data - anything extra is ignored unless we say to do something with it here.
When the server sends us an error with the license key, we want to tell the user that something went wrong, and let them know where to go to get a valid license key
After this runs, it disconnects the agent so that it will no longer try to connect to the server, saving the application and the server load
Logs when we connect to the server, for debugging purposes
When we have a problem connecting to the server, we need to tell the user what happened, since this is not an error we can handle gracefully.
Sets the collector host and connects to the server, then invokes the final configuration with the returned data
We‘ve seen objects in the environment report (Rails.env in particular) that can‘t seralize to JSON. Cope with that here and clear out so downstream code doesn‘t have to check again.