Track `ActiveRecord::StatementInvalid` errors, and raise in development
Proposal
Send ActiveRecord::StatementInvalid
errors in lib/gitlab/utils/usage_data.rb
to sentry, and raise exception in dev. In other words, use Gitlab::ErrorTracking.track_and_raise_for_dev_exception
. (Thanks @alinamihaila for this great idea)
Problem
Some ActiveRecord::StatementInvalid
cause problems as Postgres tears down the connection upon encountering such errors. It then becomes a hard thing to debug as the error can occur anywhere
*** ActiveRecord::StatementInvalid Exception: PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block
Why can't we raise in production
Data is collected per week in a instance, and we cannot backfill so we have to rescue this exception.
/cc @alinamihaila @mikolaj_wawrzyniak @a_akgun
Acceptance Criteria
-
Add track_and_raise_for_dev_exception
For each hardening method -
Update related service ping tests
Edited by Luis Mejia