lib/dry/monitor/rack/middleware.rb in dry-monitor-0.0.3 vs lib/dry/monitor/rack/middleware.rb in dry-monitor-0.1.0

- old
+ new

@@ -1,23 +1,25 @@ require 'rack/utils' +require 'dry/monitor/notifications' module Dry module Monitor module Rack class Middleware REQUEST_START = :'rack.request.start' REQUEST_STOP = :'rack.request.stop' REQUEST_ERROR = :'rack.request.error' + Notifications.register_event(REQUEST_START) + Notifications.register_event(REQUEST_STOP) + Notifications.register_event(REQUEST_ERROR) + attr_reader :app + attr_reader :notifications def initialize(*args) @notifications, @app = *args - - notifications.event(REQUEST_START) - notifications.event(REQUEST_STOP) - notifications.event(REQUEST_ERROR) end def new(app) self.class.new(notifications, app) end