7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/newrelic_security/instrumentation-security/grape/chain.rb', line 7
def self.instrument!
::Grape::API::Instance.class_eval do
include NewRelic::Security::Instrumentation::Grape::API::Instance
alias_method :call_without_security, :call
def call(env)
retval = nil
event = call_on_enter(env) do
begin
retval = call_without_security(env)
ensure
NewRelic::Security::Agent.agent.error_reporting&.report_unhandled_or_5xx_exceptions(NewRelic::Security::Agent::Control::HTTPContext.get_current_transaction, NewRelic::Security::Agent::Control::HTTPContext.get_context, nil)
end
end
call_on_exit(event, retval) { return retval }
end
end
end
|