From 58643cd5325f731799686daca8e1d9806851c320 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Fri, 15 Mar 2019 19:28:00 +0000 Subject: 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. --- Gemfile.lock | 2 +- config/initializers/sentry.rb | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index ec34d3f9d67..ac7e3cf4459 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -813,7 +813,7 @@ GEM selenium-webdriver (3.12.0) childprocess (~> 0.5) rubyzip (~> 1.2) - sentry-raven (2.7.4) + sentry-raven (2.9.0) faraday (>= 0.7.6, < 1.0) settingslogic (2.0.9) sexp_processor (4.11.0) 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 -- cgit v1.2.1