diff options
author | Stan Hu <stanhu@gmail.com> | 2018-12-07 15:29:00 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-12-07 15:29:00 +0000 |
commit | e17ccef5cadd7b8962a10bb43b1332658a54bd96 (patch) | |
tree | 05288b33ef4b4965e38a12c629041a4a6ad9d619 /app | |
parent | cda291f0c35d3724d2df916fcd95e00e84f469cf (diff) | |
parent | eb33ca49b8a402b347592c6cf982fb7619218370 (diff) | |
download | gitlab-ce-e17ccef5cadd7b8962a10bb43b1332658a54bd96.tar.gz |
Merge branch 'store-correlation-logs' into 'master'
Log and pass correlation-id between Unicorn, Sidekiq and Gitaly
See merge request gitlab-org/gitlab-ce!22844
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/application_controller.rb | 8 | ||||
-rw-r--r-- | app/helpers/icons_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/sentry_helper.rb | 11 |
3 files changed, 7 insertions, 14 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 65c1576d9d2..7c8c1392c1c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -8,7 +8,6 @@ class ApplicationController < ActionController::Base include GitlabRoutingHelper include PageLayoutHelper include SafeParamsHelper - include SentryHelper include WorkhorseHelper include EnforcesTwoFactorAuthentication include WithPerformanceBar @@ -129,6 +128,7 @@ class ApplicationController < ActionController::Base payload[:ua] = request.env["HTTP_USER_AGENT"] payload[:remote_ip] = request.remote_ip + payload[Gitlab::CorrelationId::LOG_KEY] = Gitlab::CorrelationId.current_id logged_user = auth_user @@ -155,7 +155,7 @@ class ApplicationController < ActionController::Base end def log_exception(exception) - Raven.capture_exception(exception) if sentry_enabled? + Gitlab::Sentry.track_acceptable_exception(exception) backtrace_cleaner = Gitlab.rails5? ? request.env["action_dispatch.backtrace_cleaner"] : env application_trace = ActionDispatch::ExceptionWrapper.new(backtrace_cleaner, exception).application_trace @@ -487,4 +487,8 @@ class ApplicationController < ActionController::Base def impersonator @impersonator ||= User.find(session[:impersonator_id]) if session[:impersonator_id] end + + def sentry_context + Gitlab::Sentry.context(current_user) + end end diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb index b0f63de2fb8..4e11772b252 100644 --- a/app/helpers/icons_helper.rb +++ b/app/helpers/icons_helper.rb @@ -42,7 +42,7 @@ module IconsHelper end def sprite_icon(icon_name, size: nil, css_class: nil) - if Gitlab::Sentry.should_raise? + if Gitlab::Sentry.should_raise_for_dev? unless known_sprites.include?(icon_name) exception = ArgumentError.new("#{icon_name} is not a known icon in @gitlab-org/gitlab-svg") raise exception diff --git a/app/helpers/sentry_helper.rb b/app/helpers/sentry_helper.rb deleted file mode 100644 index d53eaef9952..00000000000 --- a/app/helpers/sentry_helper.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -module SentryHelper - def sentry_enabled? - Gitlab::Sentry.enabled? - end - - def sentry_context - Gitlab::Sentry.context(current_user) - end -end |