Enable Sentry browser profiling

This commit is contained in:
Sebastian Serth
2023-08-18 09:52:52 +02:00
parent 36f0e5cc24
commit 4fc38c7208
3 changed files with 9 additions and 1 deletions

View File

@ -13,7 +13,7 @@ class ApplicationController < ActionController::Base
after_action :verify_authorized, except: %i[welcome]
around_action :mnemosyne_trace
around_action :switch_locale
before_action :set_sentry_context, :load_embed_options
before_action :set_sentry_context, :load_embed_options, :set_document_policy
protect_from_forgery(with: :exception, prepend: true)
rescue_from Pundit::NotAuthorizedError, with: :render_not_authorized
rescue_from ActiveRecord::RecordNotFound, with: :render_not_found
@ -72,6 +72,12 @@ class ApplicationController < ActionController::Base
end
end
def set_document_policy
# Instruct browsers to capture profiling data
response.set_header('Document-Policy', 'js-profiling')
end
private :set_document_policy
def set_sentry_context
return if current_user.blank?