Module: NewRelic::Security::Instrumentation::Grape::Router

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

Defined Under Namespace

Modules: Chain, Prepend

Instance Method Summary collapse

Instance Method Details

#prepare_env_from_route_on_enter(route) ⇒ Object



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

def prepare_env_from_route_on_enter(route)
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  ctxt = NewRelic::Security::Agent::Control::HTTPContext.get_context
  http_method = route.instance_variable_get(:@request_method) || route.instance_variable_get(:@options)[:method]
  ctxt.route = "#{http_method}@#{route.options[:namespace]}" unless ctxt.nil?
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end