Module: NewRelic::Security::Instrumentation::ActionDispatch::Journey::Router

Included in:
Prepend
Defined in:
lib/newrelic_security/instrumentation-security/rails/chain.rb,
lib/newrelic_security/instrumentation-security/rails/prepend.rb,
lib/newrelic_security/instrumentation-security/rails/instrumentation.rb

Defined Under Namespace

Modules: Chain, Prepend

Instance Method Summary collapse

Instance Method Details

#find_routes_on_enter(req) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/newrelic_security/instrumentation-security/rails/instrumentation.rb', line 41

def find_routes_on_enter(req)
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
  return event
end

#find_routes_on_exit(event, retval) ⇒ Object



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

def find_routes_on_exit(event, retval)
  NewRelic::Security::Agent.logger.debug "OnExit :  #{self.class}.#{__method__}"

  unless retval[0].nil?
    route = retval[0][2].path.spec.to_s.gsub(/\(\.:format\)/, EMPTY_STRING)
    ctxt = NewRelic::Security::Agent::Control::HTTPContext.get_context
    ctxt.route = "#{ctxt.method}@#{route}" unless ctxt.nil?
  end
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end