Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2019-05-11 00:12:33 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2019-05-13 21:27:41 +0300
commit4c2f6814907f3988c86c9f79a155d1d48ba61793 (patch)
treeeee0368269fc9065c81bb767d6df60b35fa02891 /lib/gitlab/sentry.rb
parent9dc41a0993a38f99eeda9c2e8bb3ace070003496 (diff)
Add correlation id to all sentry errors
Before this, we were only adding the correlation id to the "acceptable exceptions" which we handle in code. But we need to add it to the default raven context so the information would be available for uncaught exceptions.
Diffstat (limited to 'lib/gitlab/sentry.rb')
-rw-r--r--lib/gitlab/sentry.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/gitlab/sentry.rb b/lib/gitlab/sentry.rb
index 356e6445e0e..72c44114001 100644
--- a/lib/gitlab/sentry.rb
+++ b/lib/gitlab/sentry.rb
@@ -10,7 +10,7 @@ module Gitlab
def self.context(current_user = nil)
return unless enabled?
- Raven.tags_context(locale: I18n.locale)
+ Raven.tags_context(default_tags)
if current_user
Raven.user_context(
@@ -44,16 +44,19 @@ module Gitlab
extra[:issue_url] = issue_url if issue_url
context # Make sure we've set everything we know in the context
- tags = {
- Labkit::Correlation::CorrelationId::LOG_KEY.to_sym => Labkit::Correlation::CorrelationId.current_id
- }
-
- Raven.capture_exception(exception, tags: tags, extra: extra)
+ Raven.capture_exception(exception, tags: default_tags, extra: extra)
end
end
def self.should_raise_for_dev?
Rails.env.development? || Rails.env.test?
end
+
+ def self.default_tags
+ {
+ Labkit::Correlation::CorrelationId::LOG_KEY.to_sym => Labkit::Correlation::CorrelationId.current_id,
+ locale: I18n.locale
+ }
+ end
end
end