2016-01-18 16:15:10 +00:00
|
|
|
# Be sure to restart your server when you modify this file.
|
|
|
|
|
|
|
|
require 'gitlab/current_settings'
|
|
|
|
|
2017-10-03 00:52:19 +00:00
|
|
|
def configure_sentry
|
2019-04-30 20:06:08 +00:00
|
|
|
if Gitlab::Sentry.enabled?
|
2016-01-20 08:48:38 +00:00
|
|
|
Raven.configure do |config|
|
2019-04-30 20:06:08 +00:00
|
|
|
config.dsn = Gitlab.config.sentry.dsn
|
2018-05-24 07:57:54 +00:00
|
|
|
config.release = Gitlab.revision
|
2019-04-30 20:06:08 +00:00
|
|
|
config.current_environment = Gitlab.config.sentry.environment
|
2016-12-06 01:05:06 +00:00
|
|
|
|
2016-04-28 21:08:23 +00:00
|
|
|
# Sanitize fields based on those sanitized from Rails.
|
|
|
|
config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
|
2016-10-04 14:35:41 +00:00
|
|
|
# Sanitize authentication headers
|
|
|
|
config.sanitize_http_headers = %w[Authorization Private-Token]
|
2019-01-16 13:29:05 +00:00
|
|
|
config.tags = { program: Gitlab.process_name }
|
2019-09-18 14:02:45 +00:00
|
|
|
# Debugging for https://gitlab.com/gitlab-org/gitlab-foss/issues/57727
|
2019-03-15 19:28:00 +00:00
|
|
|
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-20 08:48:38 +00:00
|
|
|
end
|
2016-01-18 16:15:10 +00:00
|
|
|
end
|
|
|
|
end
|
2017-10-03 00:52:19 +00:00
|
|
|
|
2018-12-05 20:54:40 +00:00
|
|
|
configure_sentry if Rails.env.production? || Rails.env.development?
|