一个 Handle 用于记录事件的开始和结束时间。
如果可能,最好使用块的形式:ActiveSupport::Notifications.instrument。 Handle 是一个底层 API,用于不能使用块形式的场景。
handle = ActiveSupport::Notifications.instrumenter.build_handle("my.event", {}) begin handle.start # work to be instrumented ensure handle.finish end
方法
实例公共方法
finish() 链接
源码: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/notifications/fanout.rb, line 250 def finish finish_with_values(@name, @id, @payload) end
start() 链接
源码: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/notifications/fanout.rb, line 241 def start ensure_state! :initialized @state = :started iterate_guarding_exceptions(@groups) do |group| group.start(@name, @id, @payload) end end