Sentry: Upgrade sentry-raven gem
We are using sentry-raven
, ~> 3.0
. This version has a major flaw that it injects the integrations into Rails automatically. Those integrations are not configurable. We should done a series of upgrading. The main goal of the upgrading is not to change the current behavior of the system. Be aware of the big changes in the CHANGELOG.
- Upgrade
sentry-raven
(nowsentry-ruby
) to the newest version (4.1.5
). - Add
sentry-sidekiq
gem. This gem is just an extraction fromsentry-raven
. - Add
sentry-rails
gem. This gem is just an extraction fromsentry-raven
. - Scan through the Changelog to ensure the upgrade doesn't change anything. At the first glance, there is just one notable change: the event is now sent asynchronously using a thread pool. The current behavior of
Gitlab::ErrorTracking
is to send the event synchronously right after the exception is captured. We should honor this approach for now to reduce the number of moving parts.
Migrating processors (already done)
Processors
In the new Sentry gem, processors no longer exist. We can get the same behaviour ourselves with the before_send
hook and some manual work to construct a chain of processors.
The other difference is that processors receive the event as a hash prior to sending, while before_send
gets a {Sentry,Raven}::Event
object, so access to fields works differently.
This is not hard, but it does introduce risk, so we'll introduce a sentry_processors_before_send
flag that defaults to off. When it's off, we'll run the processors as normal and do no extra work in before_send
. When it's on, the processors will still be configured, but their #process
method will be a no-op, and we'll use our manually-constructed processor chain in before_send
instead.
Roll out
To make this change to processors, we'll need a few steps:
-
Allow processors to work either way with a feature flag: gitlab-org/gitlab!55648 (merged) -
Enable that feature flag in staging and verify the results -
Enable that feature flag in production and verify the results -
Remove the option to use processors in configuration, and only use our custom before_send
code