diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-03 06:09:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-03 06:09:45 +0300 |
commit | 9d5573c70ae3ef3f550bb06b62cc640165683a94 (patch) | |
tree | 8cf30fd465d82ac1d868d60e559dee4ced9eb2e8 /lib/gitlab/error_tracking.rb | |
parent | d7940ee9f8b94e68cb8c56730b65a47b85e622b2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/error_tracking.rb')
-rw-r--r-- | lib/gitlab/error_tracking.rb | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/gitlab/error_tracking.rb b/lib/gitlab/error_tracking.rb index 38ac5d9af74..635e84d799f 100644 --- a/lib/gitlab/error_tracking.rb +++ b/lib/gitlab/error_tracking.rb @@ -19,22 +19,21 @@ module Gitlab PROCESSORS = [ ::Gitlab::ErrorTracking::Processor::SidekiqProcessor, ::Gitlab::ErrorTracking::Processor::GrpcErrorProcessor, - ::Gitlab::ErrorTracking::Processor::ContextPayloadProcessor + ::Gitlab::ErrorTracking::Processor::ContextPayloadProcessor, + # IMPORTANT: this processor must stay at the bottom, right before + # sending the event to Sentry. + ::Gitlab::ErrorTracking::Processor::SanitizerProcessor ].freeze class << self def configure - Raven.configure do |config| + Sentry.init do |config| config.dsn = sentry_dsn config.release = Gitlab.revision - config.current_environment = Gitlab.config.sentry.environment - - # Sanitize fields based on those sanitized from Rails. - config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s) - - # Sanitize authentication headers - config.sanitize_http_headers = %w[Authorization Private-Token] + config.environment = Gitlab.config.sentry.environment config.before_send = method(:before_send) + config.background_worker_threads = 0 + config.send_default_pii = true yield config if block_given? end @@ -108,8 +107,11 @@ module Gitlab def process_exception(exception, sentry: false, logging: true, extra:) context_payload = Gitlab::ErrorTracking::ContextPayloadGenerator.generate(exception, extra) - if sentry && Raven.configuration.server - Raven.capture_exception(exception, **context_payload) + # There is a possibility that this method is called before Sentry is + # configured. Since Sentry 4.0, some methods of Sentry are forwarded to + # to `nil`, hence we have to check the client as well. + if sentry && ::Sentry.get_current_client && ::Sentry.configuration.dsn + ::Sentry.capture_exception(exception, **context_payload) end if logging |