Class: Treblle::Middleware

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/treblle/middleware.rb

Instance Method Summary collapse

Methods included from Logging

#log_error, #log_success, #logger

Constructor Details

#initialize(app, configuration: Treblle.configuration) ⇒ Middleware

Returns a new instance of Middleware.



14
15
16
17
# File 'lib/treblle/middleware.rb', line 14

def initialize(app, configuration: Treblle.configuration)
  @app = app
  @configuration = configuration
end

Instance Method Details

#call(env) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/treblle/middleware.rb', line 19

def call(env)
  if should_monitor?(env)
    call_with_treblle_monitoring(env)
  else
    @app.call(env)
  end
end