Class: Dbwatcher::Middleware
- Inherits:
-
Object
- Object
- Dbwatcher::Middleware
- Defined in:
- lib/dbwatcher/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
5 6 7 |
# File 'lib/dbwatcher/middleware.rb', line 5 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/dbwatcher/middleware.rb', line 9 def call(env) if should_track?(env) Dbwatcher.track( name: "HTTP #{env["REQUEST_METHOD"]} #{env["PATH_INFO"]}", metadata: (env) ) do @app.call(env) end else @app.call(env) end rescue StandardError => e warn "Dbwatcher middleware error: #{e.}" @app.call(env) end |