class Dry::Monitor::Rack::Middleware
def call(env)
def call(env) notifications.start(REQUEST_START, env: env) response, time = @clock.measure { app.call(env) } notifications.stop(REQUEST_STOP, env: env, time: time, status: response[0]) response end
def initialize(*args, clock: CLOCK)
def initialize(*args, clock: CLOCK) @notifications, @app = *args @clock = clock end
def instrument(event_id, *args, &block)
def instrument(event_id, *args, &block) notifications.instrument(:"rack.request.#{event_id}", *args, &block) end
def new(app, *_args, clock: @clock, &_block)
def new(app, *_args, clock: @clock, &_block) self.class.new(notifications, app, clock: clock) end
def on(event_id, &block)
def on(event_id, &block) notifications.subscribe(:"rack.request.#{event_id}", &block) end