| Module | NewRelic::Agent::Agent::InstanceMethods::Start |
| In: |
lib/new_relic/agent/agent.rb
|
Herein lies the corpse of the former ‘start’ method. May its unmatched flog score rest in pieces.
Sanity-check the agent configuration and start the agent, setting up the worker thread and the exit handler to shut down the agent
Connecting in the foreground blocks further startup of the agent until we have a connection - useful in cases where you‘re trying to log a very-short-running process and want to get statistics from before a server connection (typically 20 seconds) exists
Return true if we‘re using resque and it hasn‘t had a chance to (potentially) daemonize itself. This avoids hanging when there‘s a Thread started before Resque calls Process.daemon (Jira RUBY-857)
The agent is disabled when it is not force enabled by the ‘agent_enabled’ option (e.g. in a manual start), or enabled normally through the configuration file
Logs the dispatcher to the log file to assist with debugging. When no debugger is present, logs this fact to assist with proper dispatcher detection
Log the environment the app thinks it‘s running in. Useful in debugging, as this is the key for config YAML lookups.
Classy logging of the agent version and the current pid, so we can disambiguate processes in the log file and make sure they‘re running a reasonable version
Warn the user if they have configured their agent not to send data, that way we can see this clearly in the log file
There‘s an MRI 1.9 bug that loses exit codes in at_exit blocks. A workaround is necessary to get correct exit codes for the agent‘s test suites. bugs.ruby-lang.org/issues/5218
This is the shared method between the main agent startup and the after_fork call restarting the thread in deferred dispatchers.
Treatment of @started and env report is important to get right.
This matters when the following three criteria are met:
In this case, the entire application runs from an at_exit handler in Sinatra, and if we were to install ours, it would be executed before the one in Sinatra, meaning that we‘d shutdown the agent too early and never collect any data.