Skip to content

Conditionally require sentry-ruby gem

Reuben Pereira requested to merge rp/move-sentry-require into master

What does this MR do and why?

Describe in detail what your merge request does and why.

Conditionally require the sentry-ruby gem because it causes a large stacktrace for any error locally, which obfuscates the actual error. This seems to be happening because Raven attempts to send multiple events to Sentry, but since the SENTRY_DSN is not configured locally, it fails.

An example of a CI job where Raven sends multiple events: https://ops.gitlab.net/gitlab-org/release/tools/-/jobs/9730956.

Example stacktrace from a local execution. This is the last few lines of the stacktrace. The first 6 lines are repeated, so much that I cannot scroll to the top of the stacktrace.

/home/reuben/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/sentry-raven-3.1.2/lib/raven/integrations/rake.rb:15:in `display_error_message'
/home/reuben/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/sentry-ruby-5.8.0/lib/sentry/rake.rb:17:in `display_error_message'
/home/reuben/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/sentry-raven-3.1.2/lib/raven/integrations/rake.rb:15:in `display_error_message'
/home/reuben/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/sentry-ruby-5.8.0/lib/sentry/rake.rb:17:in `display_error_message'
/home/reuben/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/sentry-raven-3.1.2/lib/raven/integrations/rake.rb:15:in `display_error_message'
/home/reuben/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/sentry-ruby-5.8.0/lib/sentry/rake.rb:17:in `display_error_message'
/home/reuben/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:195:in `rescue in standard_exception_handling'
/home/reuben/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:185:in `standard_exception_handling'
/home/reuben/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
/home/reuben/.asdf/installs/ruby/2.7.8/lib/ruby/gems/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/home/reuben/.asdf/installs/ruby/2.7.8/bin/rake:23:in `load'
/home/reuben/.asdf/installs/ruby/2.7.8/bin/rake:23:in `<top (required)>'

Author Check-list

  • Has documentation been updated?
Edited by Reuben Pereira

Merge request reports