partial rewrite of kamon-newrelic