Upgrade to newest Sentry

This commit is contained in:
Sebastian Serth
2021-03-04 14:02:16 +01:00
parent 22adcaddba
commit b10e23dd16
20 changed files with 72 additions and 67 deletions

View File

@ -7,7 +7,7 @@ class ApplicationController < ActionController::Base
MEMBER_ACTIONS = %i[destroy edit show update].freeze
after_action :verify_authorized, except: %i[help welcome]
before_action :set_raven_context, :set_locale, :allow_iframe_requests, :load_embed_options
before_action :set_sentry_context, :set_locale, :allow_iframe_requests, :load_embed_options
protect_from_forgery(with: :exception, prepend: true)
rescue_from Pundit::NotAuthorizedError, with: :render_not_authorized
@ -20,17 +20,17 @@ class ApplicationController < ActionController::Base
raise Pundit::NotAuthorizedError unless current_user
end
def set_raven_context
def set_sentry_context
return if current_user.blank?
Raven.user_context(
Sentry.set_user(
id: current_user.id,
type: current_user.class.name,
username: current_user.displayname,
consumer: current_user.consumer.name
)
end
private :set_raven_context
private :set_sentry_context
def render_not_authorized
respond_to do |format|
@ -50,7 +50,7 @@ class ApplicationController < ActionController::Base
def set_locale
session[:locale] = params[:custom_locale] || params[:locale] || session[:locale]
I18n.locale = session[:locale] || I18n.default_locale
Raven.extra_context(locale: I18n.locale)
Sentry.set_extras(locale: I18n.locale)
end
private :set_locale
@ -68,7 +68,7 @@ class ApplicationController < ActionController::Base
else
{}
end
Raven.extra_context(@embed_options)
Sentry.set_extras(@embed_options)
@embed_options
end
private :load_embed_options

View File

@ -154,7 +154,7 @@ module Lti
if provider.nil?
{status: 'error'}
elsif provider.outcome_service?
Raven.extra_context({
Sentry.set_extras({
provider: provider.inspect,
score: submission.normalized_score,
lti_parameter: lti_parameter.inspect,

View File

@ -121,7 +121,7 @@ class ExecutionEnvironmentsController < ApplicationController
rescue DockerClient::Error => error
@docker_images = []
flash[:warning] = error.message
Raven.capture_exception(error)
Sentry.capture_exception(error)
end
private :set_docker_images

View File

@ -188,7 +188,7 @@ class ExercisesController < ApplicationController
rescue Proforma::ProformaError
render json: t('exercises.import_codeharbor.import_errors.invalid'), status: 400
rescue StandardError => e
Raven.capture_exception(e)
Sentry.capture_exception(e)
render json: t('exercises.import_codeharbor.import_errors.internal_error'), status: 500
end
@ -392,7 +392,7 @@ class ExercisesController < ApplicationController
end
def redirect_to_lti_return_path
Raven.extra_context(
Sentry.set_extras(
consumers_id: @submission.user&.consumer,
external_users_id: @submission.user_id,
exercises_id: @submission.exercise_id,

View File

@ -196,7 +196,7 @@ class SubmissionsController < ApplicationController
rescue JSON::ParserError => error
socket.send data
Rails.logger.debug('Rescued parsing error, sent the received client data to docker:' + data)
Raven.extra_context(data: data)
Sentry.set_extras(data: data)
end
end
@ -417,7 +417,7 @@ class SubmissionsController < ApplicationController
container = Docker::Container.get(params[:container_id])
DockerClient.destroy_container(container)
rescue Docker::Error::NotFoundError => error
Raven.capture_exception(error)
Sentry.capture_exception(error)
ensure
head :ok
end
@ -447,7 +447,7 @@ class SubmissionsController < ApplicationController
yield(server_sent_event) if block_given?
server_sent_event.write({code: 200}, event: 'close')
rescue => exception
Raven.capture_exception(exception)
Sentry.capture_exception(exception)
logger.error(exception.message)
logger.error(exception.backtrace.join("\n"))
server_sent_event.write({code: 500}, event: 'close')

View File

@ -23,7 +23,7 @@ class UserExerciseFeedbacksController < ApplicationController
end
def create
Raven.extra_context(params: uef_params)
Sentry.set_extras(params: uef_params)
@exercise = Exercise.find(uef_params[:exercise_id])
rfc = RequestForComment.unsolved.where(exercise_id: @exercise.id, user_id: current_user.id).first