将我的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 block (2 levels) in <top (required)>': uninitialized constant Mongoid::Collection (NameError) 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:53:in call'
来自/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 每个
来自/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:in 阻止检测!”
来自/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 检测!
来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/lib/new_relic/control/instrumentation.rb:93: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:in install_instrumentation'
来自/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 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:19:in中的'
来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/initializable.rb:30:in each' 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:17:in run'
来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/initializable.rb:55:in _install_instrumentation' from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/lib/new_relic/control/instrumentation.rb:52:in each'
来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/initializable.rb:54:在init_plugin' from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/newrelic_rpm-3.6.0.83/lib/newrelic_rpm.rb:40:in中初始化!''
来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/railtie/configurable.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:in'
从/Users/bashar/rails-projects/myapp/config.ru:7:在block in run_initializers' from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/initializable.rb:54:in instance_eval'中
来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/builder.rb:51:in run_initializers' from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/application.rb:136:in new'
从/Users/bashar/rails-projects/myapp/config.ru:1:在method_missing' from /Users/bashar/rails-projects/myapp/config/environment.rb:5:in eval'中
从/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/builder.rb:40:在block in <main>' from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/builder.rb:51:in app'中
来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/commands/server.rb:46:在initialize' from /Users/bashar/rails-projects/myapp/config.ru:1:in wrapped_app中
从/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/server.rb:252:in <main>' from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/builder.rb:40:in start'
从/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/commands.rb:55:in parse_file' from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/server.rb:200:in tap'
来自/Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/railties-3.2.11/lib/rails/commands.rb:50:in app' from /Users/bashar/.rvm/gems/ruby-1.9.3-preview1/gems/rack-1.4.1/lib/rack/server.rb:301:in require'
来自script / rails:6:in


我具有以下宝石:

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


过去,当我升级到Mongoid 3时遇到了类似的问题,但当时的解决方案是newrelic_moped。看来这次不是。

任何想法?

最佳答案

我也一样将以下代码添加到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

关于ruby-on-rails - 导致未初始化的常量Mongoid::Collection的新遗物(NameError),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16002682/

10-13 04:52