Module: NewRelic::Security::Instrumentation::ActionDispatch::Routing::RouteSet::Dispatcher::Chain

Defined in:
lib/newrelic_security/instrumentation-security/rails/chain.rb

Class Method Summary collapse

Class Method Details

.instrument!Object



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/newrelic_security/instrumentation-security/rails/chain.rb', line 50

def self.instrument!
  ::ActionDispatch::Routing::RouteSet::Dispatcher.class_eval do
    include NewRelic::Security::Instrumentation::ActionDispatch::Routing::RouteSet::Dispatcher

    alias_method :serve_without_security, :serve

    def serve(req)
      retval = nil
      event = serve_on_enter(req) { retval = serve_without_security(req) }
      serve_on_exit(event, retval) { return retval }
    end
  end
end