Prevent calls to external services within database transactions
In production#17504 (comment 1750994748), we noticed that sometimes we make calls to external services from within a database transaction.
Though this was not the cause of this incident, we should still prevent this: having calls to external services makes the duration of these transactions dependant on the external service and a performance degradation there could impact the availability of GitLab.com and the primary database.
Suggestion
Similar to how we implemented cross-slot redis transactions we should detect and report calls to external services that happen within a database transaction in production and report them to Sentry in the logs.
In development, this should raise an exception.