2021-12-11 22:18:48 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Currently we register validator only for `dev` or `test` environment
|
2023-01-13 00:05:48 +05:30
|
|
|
Gitlab::Database::QueryAnalyzer.instance.tap do |query_analyzer|
|
|
|
|
query_analyzer.hook!
|
2021-12-11 22:18:48 +05:30
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
query_analyzer.all_analyzers.tap do |analyzers|
|
|
|
|
analyzers.append(::Gitlab::Database::QueryAnalyzers::GitlabSchemasMetrics)
|
|
|
|
analyzers.append(::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification)
|
|
|
|
analyzers.append(::Gitlab::Database::QueryAnalyzers::Ci::PartitioningRoutingAnalyzer)
|
|
|
|
|
|
|
|
if Gitlab.dev_or_test_env?
|
|
|
|
analyzers.append(::Gitlab::Database::QueryAnalyzers::GitlabSchemasValidateConnection)
|
|
|
|
analyzers.append(::Gitlab::Database::QueryAnalyzers::QueryRecorder)
|
|
|
|
end
|
|
|
|
end
|
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
|