To show how Sentry works in an example Rails app This app demonstrates how to include and configure Sentry-Raven into a Ruby on Rails application.
To show how Sentry works in an example web app that uses Rails
- integrate the Sentry SDK into Rails https://docs.sentry.io/clients/ruby/
- trigger error that gets sent as event to sentry.io
checkout_controller.rb
has multiple endpoints for showing different ways that errors are handled- Sentry Release cycle covered in
Makefile
-
Install Ruby version 2.3.3p222 and Rails version 5.1.7
-
install gems
bundle install
- Set the DSN in application.rb
Raven.configure do |config|
config.dsn = 'https://*******@sentry.io/22323232343'
end
- Configure sentry-cli (is for creating Sentry releases) with your
SENTRY_AUTH_TOKEN
in Makefile or runexport SENTRY_AUTH_TOKEN=<your_auth_token>
. Do the same forSENTRY_ORG
andSENTRY_PROJECT
- Check your Github repo is integrated into your Sentry organization.
- run
make
, which (Makefile) creates a Sentry release and runs Rails make deploy
and go tolocalhost:3001/handled
By default raven-ruby
ignores ActionController::RoutingError
. For the purpose of demonstrating the Undefined Route Error
, config.excluded_exceptions = []
was added to the Raven config in application.rb
. This configuration changes the default behavior to allow routing errors to appear in Sentry.
More installation details here: https://docs.sentry.io/clients/ruby/