Skip to content

Commit

Permalink
Update to use Sentry Ruby SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
julianguyen committed May 9, 2023
1 parent 5545826 commit 81f4a86
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :if_not_signed_in, unless: :devise_controller?
before_action :set_raven_context, if: proc { Rails.env.production? }
before_action :set_sentry_context, if: proc { Rails.env.production? }
before_action :set_locale
around_action :with_timezone

Expand All @@ -35,9 +35,9 @@ def configure_permitted_parameters
configure_for_accept_invitation
end

def set_raven_context
Raven.user_context(id: current_user.id) if user_signed_in?
Raven.extra_context(params: params.to_unsafe_h, url: request.url)
def set_sentry_context
Sentry.set_user(id: current_user.id) if user_signed_in?
Sentry.set_extras(params: params.to_unsafe_h, url: request.url)
end

def locale
Expand Down
3 changes: 1 addition & 2 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@
config.action_controller.default_url_options = { host: primary_domain }
config.action_controller.asset_host = primary_domain

Raven.configure do |config|
Sentry.init do |config|
config.dsn = ENV['SENTRY_DSN']
config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
end

# Inserts middleware to perform automatic connection switching.
Expand Down

0 comments on commit 81f4a86

Please sign in to comment.