Restore gitlab_database_transaction_seconds_sum for Sidekiq
Background
gitlab_database_transaction_seconds_sum
measures the total time that a worker, controller or route spends in client transactions, ie inside ActiveRecord::Base#transaction
yield blocks.
These transactions and a major problem for scalability and can quickly lockup a database server and need to be carefully monitored.
Sidekiq jobs in particular are prone to causing problems with client transactions and we have in the past tracked down several issues using this metric.
For some reason it has been removed. We should make sure that it's added back.
Scope
- Bring those metrics to Sidekiq:
gitlab_database_transaction_seconds
gitlab_sql_<role>_duration_seconds
gitlab_transaction_db_<role>_count_total
gitlab_transaction_db_<role_cached_count_total
- Approach: please read #323163 (comment 521692060)
Edited by Quang-Minh Nguyen