2016-01-29 22:53:50 +05:30
|
|
|
# Be sure to restart your server when you modify this file.
|
|
|
|
|
|
|
|
require 'gitlab/current_settings'
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def configure_sentry
|
2019-09-30 21:07:59 +05:30
|
|
|
if Gitlab::Sentry.enabled?
|
2016-01-29 22:53:50 +05:30
|
|
|
Raven.configure do |config|
|
2019-09-30 21:07:59 +05:30
|
|
|
config.dsn = Gitlab.config.sentry.dsn
|
2018-10-15 14:42:47 +05:30
|
|
|
config.release = Gitlab.revision
|
2019-09-30 21:07:59 +05:30
|
|
|
config.current_environment = Gitlab.config.sentry.environment
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
# Sanitize fields based on those sanitized from Rails.
|
|
|
|
config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
|
2016-11-03 12:29:30 +05:30
|
|
|
# Sanitize authentication headers
|
|
|
|
config.sanitize_http_headers = %w[Authorization Private-Token]
|
2019-03-02 22:35:43 +05:30
|
|
|
config.tags = { program: Gitlab.process_name }
|
2019-12-04 20:38:33 +05:30
|
|
|
# Debugging for https://gitlab.com/gitlab-org/gitlab-foss/issues/57727
|
2019-07-07 11:18:12 +05:30
|
|
|
config.before_send = lambda do |event, hint|
|
|
|
|
if ActiveModel::MissingAttributeError === hint[:exception]
|
|
|
|
columns_hash = ActiveRecord::Base
|
|
|
|
.connection
|
|
|
|
.schema_cache
|
|
|
|
.instance_variable_get(:@columns_hash)
|
|
|
|
.map { |k, v| [k, v.map(&:first)] }
|
|
|
|
.to_h
|
|
|
|
|
|
|
|
event.extra.merge!(columns_hash)
|
|
|
|
end
|
|
|
|
|
|
|
|
event
|
|
|
|
end
|
2016-01-29 22:53:50 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
configure_sentry if Rails.env.production? || Rails.env.development?
|