summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-04-14 20:18:01 +0000
committerStan Hu <stanhu@gmail.com>2016-04-14 20:18:01 +0000
commit95ce4d29c31770e2caf843face3b9f57a54d91f6 (patch)
treed1692e8cf876c1e2640d636891942ec3eb273fdb
parent1f0274e55ec822a9d96da54f73b3d58d91a28a31 (diff)
parentf58312976733fadb2b0cbf4b734f8d94220cb501 (diff)
downloadgitlab-ce-95ce4d29c31770e2caf843face3b9f57a54d91f6.tar.gz
Merge branch 'rs-sentry-contexts' into 'master'
Add Sentry program context even without a current user See merge request !3729
-rw-r--r--app/controllers/application_controller.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index ce5c84ee9bc..1c53b0b21a3 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -14,7 +14,7 @@ class ApplicationController < ActionController::Base
before_action :check_password_expiration
before_action :check_2fa_requirement
before_action :ldap_security_check
- before_action :sentry_user_context
+ before_action :sentry_context
before_action :default_headers
before_action :add_gon_variables
before_action :configure_permitted_parameters, if: :devise_controller?
@@ -41,13 +41,15 @@ class ApplicationController < ActionController::Base
protected
- def sentry_user_context
- if Rails.env.production? && current_application_settings.sentry_enabled && current_user
- Raven.user_context(
- id: current_user.id,
- email: current_user.email,
- username: current_user.username,
- )
+ def sentry_context
+ if Rails.env.production? && current_application_settings.sentry_enabled
+ if current_user
+ Raven.user_context(
+ id: current_user.id,
+ email: current_user.email,
+ username: current_user.username,
+ )
+ end
Raven.tags_context(program: sentry_program_context)
end