Skip to content

Commit

Permalink
Initialize NewRelic before Rails' config-initializers
Browse files Browse the repository at this point in the history
Before, the initializer for NewRelic did not specify any ordering. In
some situations, Rails will order its load_config_initializers before
NewRelic's newrelic_rpm.start_plugin. This is a problem if NewRelic is
called in a config-initializer (e.g. when defining method tracers) and
will output the following warning:

  Agent unavailable as it hasn't been started.

This change ensures that newrelic_rpm.start_plugin always gets loaded
before config-intiializers are.
  • Loading branch information
tonyta committed Dec 22, 2017
1 parent 1b00e2b commit 4b3c200
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/newrelic_rpm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def self.run
module NewRelic
class Railtie < Rails::Railtie

initializer "newrelic_rpm.start_plugin" do |app|
initializer "newrelic_rpm.start_plugin", before: :load_config_initializers do |app|
NewRelic::Control.instance.init_plugin(:config => app.config)
end
end
Expand Down

0 comments on commit 4b3c200

Please sign in to comment.