Class: RailsSpotlight::Middlewares::RequestCompleted
- Inherits:
-
Object
- Object
- RailsSpotlight::Middlewares::RequestCompleted
- Includes:
- SkipRequestPaths
- Defined in:
- lib/rails_spotlight/middlewares/request_completed.rb
Constant Summary
Constants included from SkipRequestPaths
SkipRequestPaths::PATHS_TO_SKIP
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, app_config) ⇒ RequestCompleted
constructor
A new instance of RequestCompleted.
Constructor Details
#initialize(app, app_config) ⇒ RequestCompleted
Returns a new instance of RequestCompleted.
11 12 13 14 |
# File 'lib/rails_spotlight/middlewares/request_completed.rb', line 11 def initialize(app, app_config) @app = app @app_config = app_config end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rails_spotlight/middlewares/request_completed.rb', line 16 def call(env) return app.call(env) unless ::RailsSpotlight.config.request_completed_broadcast_enabled? if skip?(env['PATH_INFO']) || (env['HTTP_CONNECTION'] == 'Upgrade' && env['HTTP_UPGRADE'] == 'websocket') app.call(env) else status, headers, body = app.call(env) publish_event(status, headers, env) [status, headers, body] end rescue => e # rubocop:disable Style/RescueStandardError ::RailsSpotlight.config.logger.error "Error in RailsSpotlight::Middlewares::RequestCompletedHandler instrumentation: #{e.}" app.call(env) end |