CorbanR/newrelic_sidekiq_agent — pull request #1 by uxp (2014-02-18 18:41:42+00:00)
Title: Clean up privilege drop code. Sort of.

We probably need to setup the agent plugin as the privileged user (in order
to write PID files and the like), but running it as a privileged user (like
root) doesn't make a ton of sense. NewRelic's plugin guides also recommend
against it. So lets simply drop to an unprivileged user after setup.
Unfortunately, NewRelic's plugin API doesn't give us a clean way to invoke
code around the setup process, so I've had to monkeypatch the plugin's
loop_forever method to inject myself around the loop. It's ugly, but I like
the result better.