debian-mirror-gitlab/config/initializers/database_query_analyzers.rb

18 lines
710 B
Ruby
Raw Normal View History

2021-12-11 22:18:48 +05:30
# frozen_string_literal: true
# Currently we register validator only for `dev` or `test` environment
2022-05-07 20:08:51 +05:30
Gitlab::Database::QueryAnalyzer.instance.hook!
Gitlab::Database::QueryAnalyzer.instance.all_analyzers.append(::Gitlab::Database::QueryAnalyzers::GitlabSchemasMetrics)
2022-08-27 11:52:29 +05:30
Gitlab::Database::QueryAnalyzer.instance.all_analyzers.append(
::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification
)
2021-12-11 22:18:48 +05:30
2022-08-27 11:52:29 +05:30
if Gitlab.dev_or_test_env?
query_analyzer = ::Gitlab::Database::QueryAnalyzers::GitlabSchemasValidateConnection
Gitlab::Database::QueryAnalyzer.instance.all_analyzers.append(query_analyzer)
2022-05-07 20:08:51 +05:30
end
2021-12-11 22:18:48 +05:30
2022-05-07 20:08:51 +05:30
Gitlab::Application.configure do |config|
config.middleware.use(Gitlab::Middleware::QueryAnalyzer)
2021-12-11 22:18:48 +05:30
end