Class: Contrast::Framework::Rails::Patch::ActionControllerLiveBuffer
- Defined in:
- lib/contrast/framework/rails/patch/action_controller_live_buffer.rb
Overview
This class acts as our patch into the ActionController::Live::Buffer class, allowing us to track the close event on streamed responses.
Class Method Summary collapse
Class Method Details
.instrument ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/contrast/framework/rails/patch/action_controller_live_buffer.rb', line 20 def instrument @_instrument ||= begin ::ActionController::Live::Buffer.class_eval do # normally pre->in->post filters are applied however, in a streamed response # we can run into a case where it's pre -> in -> post -> more infilters # in order to submit anything found during the infilters after the response has # been written we need to explicitly send them alias_method :cs__close, :close def close Contrast::Framework::Rails::Patch::ActionControllerLiveBuffer. cs__close end end true end end |
.send_messages ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/contrast/framework/rails/patch/action_controller_live_buffer.rb', line 12 def return unless (context = Contrast::Agent::REQUEST_TRACKER.current) [context.server_activity, context.activity, context.observed_route].each do |msg| Contrast::Agent.messaging_queue.send_event_immediately(msg) end end |