ruby-on-railsruby-on-rails-4herokuerror-handlingnewrelic

How do I stop Routing Errors errors from causing all sorts of warning?


My Rails 4 app on Heroku (currently on unicorn) doesn't have too many errors usually but it gets tons of bad URLs. Whenever a bad URL is entered, the user sees my 404 page and an ActionController::RoutingError is raised in Rails. This gets reported to Rollbar and NewRelic as errors, and they raise the alarms. I'm constantly getting alerts from NewRelic about all these "errors". How do I prevent a routing error from being reported as an error?

(I tried changing a line in newrelic.yml to ignore_errors: ActionController::RoutingError but it didn't help.)


Solution

  • If you're using Server Side Config (determine this on the app's Settings page in New Relic), be sure that ActionController::RoutingError is included in the Ignore these errors field.

    You might also try setting an environment variable on Heroku to ignore errors like this. For example, NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERRORS="ActiveRecord::RecordNotFound, ActionController::RoutingError"