summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2019-03-15 19:28:00 +0000
committerSean McGivern <sean@gitlab.com>2019-03-19 13:49:31 +0000
commit58643cd5325f731799686daca8e1d9806851c320 (patch)
tree0d2fdd3d519ec96ed3d2f6dd1b66ee9ff7589de1 /config
parent5fc1d2ad9fcea0d9ad4455766c0af29095b8b177 (diff)
downloadgitlab-ce-58643cd5325f731799686daca8e1d9806851c320.tar.gz
Send schema cache to Sentry on MissingAttributeError
We don't know why this happens, so this is an attempt to debug the issue by sending a full list of all columns ActiveRecord knows about when the error is raised.
Diffstat (limited to 'config')
-rw-r--r--config/initializers/sentry.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb
index abc91c3ae51..680cfa6f0ed 100644
--- a/config/initializers/sentry.rb
+++ b/config/initializers/sentry.rb
@@ -20,6 +20,21 @@ def configure_sentry
# Sanitize authentication headers
config.sanitize_http_headers = %w[Authorization Private-Token]
config.tags = { program: Gitlab.process_name }
+ # Debugging for https://gitlab.com/gitlab-org/gitlab-ce/issues/57727
+ 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
end
end
end