Added a new dependency for the router that can be specified via the monitoring: keyword argument for Hanami::Router#initialize.
The object must respond to #call(*, &blk).
This PR ships with a default monitoring implementation based on dry-events.
# Gemfile
gem "hanami-router"
gem "dry-events"
require "hanami/router"
require "hanami/router/monitoring"
router = Hanami::Router.new(monitoring: Hanami::Router::Monitoring.new) do
root { "Hello" }
end
router.subscribe("hanami.monitoring.router.lookup") do |event|
puts "Router took #{event.payload.fetch(:elapsed)}ms to lookup"
end
router.call(env)
# => "Router took 0.005ms to lookup"
Feature
Introduce monitoring concept in
Hanami::Router
.Added a new dependency for the router that can be specified via the
monitoring:
keyword argument forHanami::Router#initialize
. The object must respond to#call(*, &blk)
.This PR ships with a default monitoring implementation based on
dry-events
.