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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
823 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
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