I am using redis-rails-instrumentation and I love it. Thanks for developing first!
I want to track some custom runtime too, so I created an initializer but nothing happens.
I test with ActiveSupport::Notifications.instrument('read_fragment.cells', key: "test")
If I paste this code into rails console than it works (see debug level logging)
Can you help me found out the reasons?
My initializer
# frozen_string_literal: true
require "action_controller"
require "active_support"
require "sweet_notifications"
module Cells
module Rails
module Instrumentation
Railtie, LogSubscriber = SweetNotifications.subscribe(
:cells,
label: "Cells",
) do
color(
::ActiveSupport::LogSubscriber::CYAN,
::ActiveSupport::LogSubscriber::MAGENTA,
)
event :read_fragment, runtime: true do |event|
next unless logger.debug?
key = event.payload[:key]
debug(
message(event, "Cells", "read_fragment: #{key}"),
)
end
event :write_fragment, runtime: true do |event|
next unless logger.debug?
key = event.payload[:key]
debug(
message(event, "Cells", "write_fragment: #{key}"),
)
end
end
end
end
end
I am using
redis-rails-instrumentation
and I love it. Thanks for developing first! I want to track some custom runtime too, so I created an initializer but nothing happens.I test with
ActiveSupport::Notifications.instrument('read_fragment.cells', key: "test")
If I paste this code into rails console than it works (see debug level logging)Can you help me found out the reasons?
My initializer