Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spree API and New Relic monitoring

I've got problem with monitoring my app with New Relic.

I have latest Spree engine mounted in my routes and own controller to serve as root.

For some reason, New Relic gathers only data from this root route, any call to Spree JSON API is ignored and don't show up in Dashboard, so I can see only one transaction and it's pretty useless.

Is there any way to enable monitoring on whole mounted app? Am I missing something?

like image 990
methyl Avatar asked Dec 28 '25 10:12

methyl


1 Answers

As long as you're running on Rails 4.0 or later, adding the following to app/controllers/spree/api/base_controller_decorator.rb or some equivalent location should get instrumentation wired up:

class Spree::Api::BaseController
  include ActionController::Instrumentation
end

This works because on Rails 4.0 and later New Relic's controller instrumentation is based off ActiveSupport::Notifications, and include ActionController::Instrumentation gets those events flowing.

like image 124
jasonrclark Avatar answered Dec 31 '25 02:12

jasonrclark