Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitoring #216

Closed
wants to merge 3 commits into from
Closed

Monitoring #216

wants to merge 3 commits into from

Conversation

jodosha
Copy link
Member

@jodosha jodosha commented Jun 19, 2021

Feature

Introduce monitoring concept in Hanami::Router.

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"

@jodosha jodosha self-assigned this Jun 19, 2021
@jodosha
Copy link
Member Author

jodosha commented Nov 7, 2022

Stale.

@jodosha jodosha closed this Nov 7, 2022
@jodosha jodosha deleted the feature/monitoring branch November 7, 2022 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant