class RailsRiemannMiddleware::Notifier

Attributes

event[R]
options[R]
send_durations[R]
send_exceptions[R]

Public Class Methods

new(app, options = {}) click to toggle source
# File lib/rails_riemann_middleware.rb, line 11
def initialize(app, options = {})
  @app, @options = app, options
  @send_durations  = options.fetch(:send_durations, true)
  @send_exceptions = options.fetch(:send_exceptions, true)
  @event = Event.new(options)
end

Public Instance Methods

call(env) click to toggle source
# File lib/rails_riemann_middleware.rb, line 18
def call(env)
  start_time = Time.now
  @app.call(env)
rescue Exception => exception
  ExceptionNotification.new(event, env, exception, options).send if send_exceptions
  raise exception
ensure
  Duration.new(event, env, start_time, options).send if send_durations
end