|
|
@ -15,51 +15,18 @@ def build_instrumentation_config |
|
|
|
end.compact |
|
|
|
end |
|
|
|
|
|
|
|
Rails.autoloaders.main.on_load('ApplicationController') do |
|
|
|
puts '--- Zeitwerk RELOAD ---' |
|
|
|
Semantic::Instrumentalizer.activate(*build_instrumentation_config) |
|
|
|
end |
|
|
|
|
|
|
|
Rails.configuration.after_initialize do |
|
|
|
puts '---- AFTER INITIALIZE ---------' |
|
|
|
Rails.logger.name = 'rails' |
|
|
|
|
|
|
|
ActiveSupport::Notifications.subscribe('rolling.live_constant') do |event| |
|
|
|
puts event.payload[:changes].inspect |
|
|
|
# TODO: if key includes ACTIVE_RECORD ACTION_VIEW |
|
|
|
constants = event.payload[:changes].map { |change| change[:constant] } |
|
|
|
if constants.intersection(%w[ACTIVE_RECORD ACTION_VIEW]).any? |
|
|
|
Semantic::Instrumentalizer.activate(*build_instrumentation_config) |
|
|
|
end |
|
|
|
|
|
|
|
# im = nil |
|
|
|
# Rails.autoloaders.main.on_load('ApplicationController') do |
|
|
|
# SemanticLogger[:zeitwerk].debug('reload!') |
|
|
|
# im = Semantic::InstrumentationManager.new |
|
|
|
# end |
|
|
|
|
|
|
|
# Semantic::InstrumentationManager.clear |
|
|
|
|
|
|
|
# bootstrap = [{ kind: :restored, constant: 'ACTION_VIEW', type: :boolean, old_value: false, new_value: true }, |
|
|
|
# { kind: :restored, constant: 'ACTION_CONTROLLER', type: :boolean, old_value: false, new_value: true }] |
|
|
|
# im ||= Semantic::InstrumentationManager.new |
|
|
|
# im.process(bootstrap) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
# RAILS_HOOKS = %i[ |
|
|
|
# action_controller |
|
|
|
# action_controller_api |
|
|
|
# action_controller_base |
|
|
|
# action_dispatch_request |
|
|
|
# action_dispatch_response |
|
|
|
# action_view |
|
|
|
# active_job |
|
|
|
# active_model |
|
|
|
# active_record |
|
|
|
# active_record_fixture_set |
|
|
|
# after_initialize |
|
|
|
# after_routes_loaded |
|
|
|
# before_configuration |
|
|
|
# before_eager_load |
|
|
|
# before_initialize |
|
|
|
# i18n |
|
|
|
# message_pack |
|
|
|
# ].freeze |
|
|
|
Rails.autoloaders.main.on_load('ApplicationController') do |
|
|
|
Rails.logger.debug 'Zeitwerk RELOAD!' |
|
|
|
Semantic::Instrumentalizer.activate(*build_instrumentation_config) |
|
|
|
end |