Commit 74eb96b4 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'enable-query-analyzers-in-production' into 'master'

Allow to enable query analyzers in production

See merge request gitlab-org/gitlab!74078
parents 06d60068 a012dd32
# frozen_string_literal: true
# Currently we register validator only for `dev` or `test` environment
Gitlab::Database::QueryAnalyzer.new.hook! if Gitlab.dev_or_test_env?
if Gitlab.dev_or_test_env? || Gitlab::Utils.to_boolean(ENV['GITLAB_ENABLE_QUERY_ANALYZERS'], default: false)
Gitlab::Database::QueryAnalyzer.instance.hook!
end
......@@ -5,6 +5,8 @@ module Gitlab
# The purpose of this class is to implement a various query analyzers based on `pg_query`
# And process them all via `Gitlab::Database::QueryAnalyzers::*`
class QueryAnalyzer
include ::Singleton
ANALYZERS = [].freeze
Parsed = Struct.new(
......
......@@ -65,7 +65,7 @@ RSpec.describe Gitlab::Database::QueryAnalyzer do
def process_sql(sql)
ApplicationRecord.load_balancer.read_write do |connection|
described_class.new.send(:process_sql, sql, connection)
described_class.instance.send(:process_sql, sql, connection)
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment