Use sentry in env production only
This commit is contained in:
parent
7658a64469
commit
7a609858f0
3 changed files with 17 additions and 13 deletions
6
Gemfile
6
Gemfile
|
@ -293,6 +293,9 @@ end
|
||||||
|
|
||||||
group :production do
|
group :production do
|
||||||
gem "gitlab_meta", '7.0'
|
gem "gitlab_meta", '7.0'
|
||||||
|
|
||||||
|
# Sentry integration
|
||||||
|
gem 'sentry-raven'
|
||||||
end
|
end
|
||||||
|
|
||||||
gem "newrelic_rpm", '~> 3.9.4.245'
|
gem "newrelic_rpm", '~> 3.9.4.245'
|
||||||
|
@ -314,6 +317,3 @@ gem 'oauth2', '~> 1.0.0'
|
||||||
|
|
||||||
# Soft deletion
|
# Soft deletion
|
||||||
gem "paranoia", "~> 2.0"
|
gem "paranoia", "~> 2.0"
|
||||||
|
|
||||||
# Sentry integration
|
|
||||||
gem 'sentry-raven'
|
|
||||||
|
|
|
@ -242,7 +242,9 @@
|
||||||
= f.label :sentry_enabled do
|
= f.label :sentry_enabled do
|
||||||
= f.check_box :sentry_enabled
|
= f.check_box :sentry_enabled
|
||||||
Enable Sentry
|
Enable Sentry
|
||||||
%span.help-block#sentry_help_block Sentry is an error reporting and logging tool
|
.help-block
|
||||||
|
Sentry is an error reporting and logging tool which is currently not shipped with GitLab, get it here:
|
||||||
|
%a{ href: 'https://getsentry.com', target: 'blank' } https://getsentry.com
|
||||||
|
|
||||||
.form-group
|
.form-group
|
||||||
= f.label :sentry_dsn, 'Sentry DSN', class: 'control-label col-sm-2'
|
= f.label :sentry_dsn, 'Sentry DSN', class: 'control-label col-sm-2'
|
||||||
|
|
|
@ -3,15 +3,17 @@
|
||||||
require 'gitlab/current_settings'
|
require 'gitlab/current_settings'
|
||||||
include Gitlab::CurrentSettings
|
include Gitlab::CurrentSettings
|
||||||
|
|
||||||
# allow it to fail: it may do so when create_from_defaults is executed before migrations are actually done
|
if Rails.env.production?
|
||||||
begin
|
# allow it to fail: it may do so when create_from_defaults is executed before migrations are actually done
|
||||||
|
begin
|
||||||
sentry_enabled = current_application_settings.sentry_enabled
|
sentry_enabled = current_application_settings.sentry_enabled
|
||||||
rescue
|
rescue
|
||||||
sentry_enabled = false
|
sentry_enabled = false
|
||||||
end
|
end
|
||||||
|
|
||||||
if sentry_enabled
|
if sentry_enabled
|
||||||
Raven.configure do |config|
|
Raven.configure do |config|
|
||||||
config.dsn = current_application_settings.sentry_dsn
|
config.dsn = current_application_settings.sentry_dsn
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue