File tree Expand file tree Collapse file tree 2 files changed +15
-14
lines changed
actionpack/lib/action_controller Expand file tree Collapse file tree 2 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -92,19 +92,19 @@ class Railtie < Rails::Railtie # :nodoc:
92
92
end
93
93
94
94
initializer "action_controller.query_log_tags" do |app |
95
- ActiveSupport . on_load ( :active_record ) do
96
- if app . config . active_record . query_log_tags_enabled && app . config . action_controller . log_query_tags_around_actions != false
95
+ if app . config . active_record . query_log_tags_enabled && app . config . action_controller . log_query_tags_around_actions != false
96
+ app . config . active_record . query_log_tags += [ :controller , :action ]
97
+
98
+ ActiveSupport . on_load ( :action_controller ) do
99
+ include ActionController ::QueryTags
100
+ end
101
+
102
+ ActiveSupport . on_load ( :active_record ) do
97
103
ActiveRecord ::QueryLogs . taggings . merge! (
98
104
controller : -> { context [ :controller ] &.controller_name } ,
99
105
action : -> { context [ :controller ] &.action_name } ,
100
106
namespaced_controller : -> { context [ :controller ] &.class &.name }
101
107
)
102
-
103
- ActiveRecord ::QueryLogs . tags + [ :controller , :action ]
104
-
105
- ActiveSupport . on_load ( :action_controller ) do
106
- include ActionController ::QueryTags
107
- end
108
108
end
109
109
end
110
110
end
Original file line number Diff line number Diff line change @@ -55,14 +55,15 @@ class Railtie < Rails::Railtie # :nodoc:
55
55
end
56
56
57
57
initializer "active_job.query_log_tags" do |app |
58
+ if app . config . active_record . query_log_tags_enabled && app . config . active_job . log_query_tags_around_perform != false
59
+ app . config . active_record . query_log_tags << :job
60
+
61
+ ActiveSupport . on_load ( :active_job ) do
62
+ include ActiveJob ::QueryTags
63
+ end
64
+
58
65
ActiveSupport . on_load ( :active_record ) do
59
- if app . config . active_record . query_log_tags_enabled && app . config . active_job . log_query_tags_around_perform != false
60
66
ActiveRecord ::QueryLogs . taggings [ :job ] = -> { context [ :job ] &.class &.name }
61
- ActiveRecord ::QueryLogs . tags << :job
62
-
63
- ActiveSupport . on_load ( :active_job ) do
64
- include ActiveJob ::QueryTags
65
- end
66
67
end
67
68
end
68
69
end
You can’t perform that action at this time.
0 commit comments