diff --git a/Gemfile b/Gemfile index 8059b258..c7afeadd 100644 --- a/Gemfile +++ b/Gemfile @@ -144,7 +144,7 @@ gem 'axlsx', git: 'https://github.com/randym/axlsx.git' gem 'axlsx_rails' # as error catcher -gem 'airbrake' +gem 'sentry-rails' # to make links faster gem 'turbolinks' diff --git a/Gemfile.lock b/Gemfile.lock index 51c0399d..a578e013 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -68,10 +68,6 @@ GEM addressable (2.6.0) public_suffix (>= 2.0.2, < 4.0) afm (0.2.2) - airbrake (9.2.2) - airbrake-ruby (~> 4.4) - airbrake-ruby (4.4.0) - rbtree3 (~> 0.5) ajax-datatables-rails (0.4.3) railties (>= 4.0) archive-zip (0.12.0) @@ -446,7 +442,6 @@ GEM rb-fsevent (0.10.3) rb-inotify (0.10.0) ffi (~> 1.0) - rbtree3 (0.5.0) recaptcha (4.14.0) json redcarpet (3.5.1) @@ -526,6 +521,12 @@ GEM selenium-webdriver (3.142.6) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) + sentry-rails (4.2.2) + rails (>= 5.0) + sentry-ruby-core (~> 4.2.0) + sentry-ruby-core (4.2.2) + concurrent-ruby + faraday sexp_processor (4.11.0) shellany (0.0.1) shoulda-matchers (4.1.2) @@ -617,7 +618,6 @@ DEPENDENCIES active_model_serializers acts_as_commentable_with_threading acts_as_list - airbrake ajax-datatables-rails autoprefixer-rails awesome_nested_set @@ -707,6 +707,7 @@ DEPENDENCIES ruby-oembed sass-rails (>= 4.0.2) selectize-rails + sentry-rails shoulda-matchers simplecov-cobertura skylight diff --git a/config/initializers/airbrake.rb b/config/initializers/airbrake.rb deleted file mode 100644 index e3c96dfc..00000000 --- a/config/initializers/airbrake.rb +++ /dev/null @@ -1,22 +0,0 @@ -Airbrake.configure do |config| - # Change this to some sensible data for your errbit instance - config.project_id = ENV['OSEM_ERRBIT_ID'] || Rails.application.secrets.errbit_id || '' - config.project_key = ENV['OSEM_ERRBIT_KEY'] || Rails.application.secrets.errbit_key || '' - config.host = ENV['OSEM_ERRBIT_HOST'] - config.environment = Rails.env - if config.project_key.blank? || config.host.blank? - config.ignore_environments = [:production, :development, :test] - else - config.ignore_environments = [:development, :test] - end -end - -Airbrake.add_filter do |notice| - notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActiveRecord::RecordNotFound' } - notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionController::InvalidAuthenticityToken' } - notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionController::UnknownAction' } - notice.ignore! if notice[:errors].any? { |error| error[:type] == 'AbstractController::ActionNotFound' } - notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionView::MissingTemplate' } - notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionController::UnknownFormat' } - notice.ignore! if notice[:errors].any? { |error| error[:type] == 'ActionController::RoutingError' && error[:message] =~ %r{\[GET\]} } -end diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb new file mode 100644 index 00000000..b61d6a1e --- /dev/null +++ b/config/initializers/sentry.rb @@ -0,0 +1,12 @@ +Sentry.init do |config| + config.dsn = ENV.fetch('OSEM_SENTRY_DSN', Rails.application.secrets.sentry_dsn) + config.breadcrumbs_logger = [:active_support_logger] + + # To activate performance monitoring, set one of these options. + # We recommend adjusting the value in production: + config.traces_sample_rate = 0.5 + # or + # config.traces_sampler = lambda do |context| + # true + # end +end diff --git a/config/secrets.yml.example b/config/secrets.yml.example index a8d67504..c0d92bbf 100644 --- a/config/secrets.yml.example +++ b/config/secrets.yml.example @@ -31,8 +31,8 @@ production: # Generate your own with rake secret or use the environment # secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> - # Your errbit API key - # errbit_key: '12345' + # Your sentry.io DSN key + # sentry_dsn: '12345' ########## OMNIAUTH Providers ########## # Leave the variables' names empty, unless you use the providers, in which diff --git a/dotenv.example b/dotenv.example index ca6bbfa8..dfecb0cb 100644 --- a/dotenv.example +++ b/dotenv.example @@ -52,12 +52,8 @@ # See https://github.com/openSUSE/osem/wiki/Translation # OSEM_TRANSIFEX_APIKEY=1234 -# The errbit host to post exceptions to -# OSEM_ERRBIT_HOST=errbit.example.com -# The project to use on the errbit host -# OSEM_ERRBIT_ID=1234 -# The key for this project -# OSEM_ERRBIT_KEY=5678 +# sentry.io DSN key +# OSEM_SENTRY_DSN=1234 # OMNIAUTH Developer Key/Secret for GOOGLE # OSEM_GOOGLE_KEY=1234