mirror of https://github.com/rails/rails
Fix initialization proccess of the query tags
The tags were being added in the wrong way, now it is always using the configuration.
This commit is contained in:
parent
16242464db
commit
18cd634e07
|
@ -92,19 +92,19 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
initializer "action_controller.query_log_tags" do |app|
|
initializer "action_controller.query_log_tags" do |app|
|
||||||
ActiveSupport.on_load(:active_record) do
|
if app.config.active_record.query_log_tags_enabled && app.config.action_controller.log_query_tags_around_actions != false
|
||||||
if app.config.active_record.query_log_tags_enabled && app.config.action_controller.log_query_tags_around_actions != false
|
app.config.active_record.query_log_tags += [:controller, :action]
|
||||||
|
|
||||||
|
ActiveSupport.on_load(:action_controller) do
|
||||||
|
include ActionController::QueryTags
|
||||||
|
end
|
||||||
|
|
||||||
|
ActiveSupport.on_load(:active_record) do
|
||||||
ActiveRecord::QueryLogs.taggings.merge!(
|
ActiveRecord::QueryLogs.taggings.merge!(
|
||||||
controller: -> { context[:controller]&.controller_name },
|
controller: -> { context[:controller]&.controller_name },
|
||||||
action: -> { context[:controller]&.action_name },
|
action: -> { context[:controller]&.action_name },
|
||||||
namespaced_controller: -> { context[:controller]&.class&.name }
|
namespaced_controller: -> { context[:controller]&.class&.name }
|
||||||
)
|
)
|
||||||
|
|
||||||
ActiveRecord::QueryLogs.tags + [:controller, :action]
|
|
||||||
|
|
||||||
ActiveSupport.on_load(:action_controller) do
|
|
||||||
include ActionController::QueryTags
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -55,14 +55,15 @@ module ActiveJob
|
||||||
end
|
end
|
||||||
|
|
||||||
initializer "active_job.query_log_tags" do |app|
|
initializer "active_job.query_log_tags" do |app|
|
||||||
ActiveSupport.on_load(:active_record) do
|
if app.config.active_record.query_log_tags_enabled && app.config.active_job.log_query_tags_around_perform != false
|
||||||
if app.config.active_record.query_log_tags_enabled && app.config.active_job.log_query_tags_around_perform != false
|
app.config.active_record.query_log_tags << :job
|
||||||
ActiveRecord::QueryLogs.taggings[:job] = -> { context[:job]&.class&.name }
|
|
||||||
ActiveRecord::QueryLogs.tags << :job
|
|
||||||
|
|
||||||
ActiveSupport.on_load(:active_job) do
|
ActiveSupport.on_load(:active_job) do
|
||||||
include ActiveJob::QueryTags
|
include ActiveJob::QueryTags
|
||||||
end
|
end
|
||||||
|
|
||||||
|
ActiveSupport.on_load(:active_record) do
|
||||||
|
ActiveRecord::QueryLogs.taggings[:job] = -> { context[:job]&.class&.name }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue