首页 文章

新Relic导致未初始化的常量Mongoid :: Collection(NameError)

提问于
浏览
3

将我的Heroku应用程序移动到Unicorn之后,New Relic停止显示除部署之外的任何报告 . 我尝试了这里建议的解决方案:https://newrelic.com/docs/ruby/no-data-with-unicorn没有运气 . 我尝试更新所有宝石,现在我收到错误:

退出/Users/bashar/.rvm/gems/ruby-1.9.3-preview1@global/gems/rpm_contrib-2.1.11/lib/rpm_contrib/instrumentation/mongoid.rb:13:in块(2级)in < top(必填)>':来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/vendor/gems/dependency_detection-0.0的未初始化常量Mongoid :: Collection(NameError) .1.build / lib / dependency_detection.rb:53:incall'来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/vendor/gems/dependency_detection-0.0 . 1.build/lib/dependency_detection.rb:53:in block in execute'from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/vendor/gems/dependency_detection- 0.0.1.build/lib/dependency_detection.rb:52:ineach'来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/vendor/gems/dependency_detection-0.0 .1.build / lib / dependency_detection.rb:52:执行'from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/vendor/gems/dependency_detection-0.0 0.1 . build / lib / dependency_detection.rb:19:inblock in detect!'来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:17:in each'来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/vendor/gems/dependency_detection-0.0.1.build/lib/dependency_detection.rb:17:indetect!'来自/Users/basms/.rvm来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/lib/new_relic/control/instrumentation.rb:93:in _install_instrumentation' /gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/lib/new_relic/control/instrumentation.rb:52:ininstall_instrumentation'from /Users/bashar/.rvm/gems/ruby-1.9.3- preview1 / gems / newrelic_rpm-3.6.0.83 / lib / new_relic / control / instance_methods.rb:76:in init_plugin'from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6 . 0.83 / lib / newrelic_rpm.rb:40:inblock in'from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/initializable.rb:30: in instance_exec'from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/initializable.rb:30:inrun'from /Users/bashar/.rvm /gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/initializable.rb:55:in在run_initializers中的阻止来自/Users/bashar/.rvm/gems/ruby-1.9.3 -preview1 /宝石/ railties-3.2.11 / LIB /轨道/ initializable.rb:54: ineach'来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/initializable.rb:54:in run_initializers'来自/Users/bashar/.rvm /gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/application.rb:136:ininitialize!”来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in method_missing'来自/ Users / bashar / rails- projects / myapp / config / environment.rb:5:in / from /Users/bashar/rails-projects/myapp/config.ru:7:in block in <main>'from /Users/bashar/.rvm/gems/ ruby-1.9.3-preview1 / gems / rack-1.4.1 / lib / rack / builder.rb:51:ininstance_eval'来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack -1.4.1 / lib / rack / builder.rb:51:从/ Users / bashar / rails-projects / myapp /初始化'from /Users/bashar/rails-projects/myapp/config.ru:1:innew' config.ru:1:in <main>'来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/builder.rb:40:ineval'来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/builder.rb:40:in parse_file'来自/Users/bashar/.rvm/gems /ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/server.rb:200:inapp'来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/ railties-3.2.11 / lib / rails / commands / server.rb:46:in app'来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/server.rb:301:inwrapped_app'来自/Users/bashar/.rvm/gems/ ruby-1.9.3-preview1 / gems / rack-1.4.1 / lib / rack / server.rb:252:in start'from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/ railties-3.2.11 / lib / rails / commands / server.rb:70:instart'from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails /commands.rb:55:in在/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/commands中的<top(required)>'块中 . rb:50:来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/commands.rb:50:in <top(required)>'from script / rails:6 :inrequire'from script / rails:6:in''

我按顺序拥有以下宝石:

gem 'rpm_contrib'
gem 'newrelic_rpm'
gem 'newrelic_moped'

我在升级到Mongoid 3时遇到了类似的问题,但当时解决方案是newrelic_moped . 似乎不是这个时候 .

任何的想法?

1 回答

  • 0

    我有同样的 . 将以下代码添加到 config/initializers/newrelic.rb

    # Ensure the agent is started using Unicorn.
    # This is needed when using Unicorn and preload_app is not set to true.
    # See https://newrelic.com/docs/ruby/no-data-with-unicorn
    if defined? Unicorn
      ::NewRelic::Agent.manual_start()
      ::NewRelic::Agent.after_fork(:force_reconnect => true)
    end
    

相关问题