Commit 86abe907 authored by Kamil Trzciński's avatar Kamil Trzciński

Allow to enable query analyzers in production

This adds `GITLAB_ENABLE_QUERY_ANALYZERS` (disabled by default)
to allow enable this in production.
parent 89d0caa1
# 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('GITLAB_ENABLE_QUERY_ANALYZERS', default: false)
Gitlab::Database::QueryAnalyzer.instance.hook!
end
......@@ -11,6 +11,10 @@ module Gitlab
:sql, :connection, :pg
)
def self.instance
@instance ||= new
end
def hook!
@subscriber = ActiveSupport::Notifications.subscribe('sql.active_record') do |event|
process_sql(event.payload[:sql], event.payload[:connection])
......
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