diff options
author | Dylan Griffith <dyl.griffith@gmail.com> | 2018-11-14 11:10:36 +0000 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2018-11-14 11:10:36 +0000 |
commit | ba7cfdc2d7f3f7da8effc0b445465ed760684575 (patch) | |
tree | 32417b0d35719444af1378d2ac031ae2025258d5 /lib | |
parent | dff3ded57f6bb4777152fb429af906125526113e (diff) | |
download | gitlab-ce-ba7cfdc2d7f3f7da8effc0b445465ed760684575.tar.gz |
Track Kubernetes errors using Sentry
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/sentry.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/gitlab/sentry.rb b/lib/gitlab/sentry.rb index 24e3866128b..8079c5882c4 100644 --- a/lib/gitlab/sentry.rb +++ b/lib/gitlab/sentry.rb @@ -7,7 +7,7 @@ module Gitlab end def self.context(current_user = nil) - return unless self.enabled? + return unless enabled? Raven.tags_context(locale: I18n.locale) @@ -29,14 +29,22 @@ module Gitlab # # Provide an issue URL for follow up. def self.track_exception(exception, issue_url: nil, extra: {}) + track_acceptable_exception(exception, issue_url: issue_url, extra: extra) + + raise exception if should_raise? + end + + # This should be used when you do not want to raise an exception in + # development and test. If you need development and test to behave + # just the same as production you can use this instead of + # track_exception. + def self.track_acceptable_exception(exception, issue_url: nil, extra: {}) if enabled? extra[:issue_url] = issue_url if issue_url context # Make sure we've set everything we know in the context Raven.capture_exception(exception, extra: extra) end - - raise exception if should_raise? end def self.program_context |