Module: NewRelic::Security::Instrumentation::GRPC::ActiveCall

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

Defined Under Namespace

Modules: Chain, Prepend

Instance Method Summary collapse

Instance Method Details

#output_metadata_on_enterObject



51
52
53
54
55
56
57
58
59
# File 'lib/newrelic_security/instrumentation-security/grpc/server/instrumentation.rb', line 51

def 
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  NewRelic::Security::Agent::Utils.delete_created_files(NewRelic::Security::Agent::Control::GRPCContext.get_context)
  NewRelic::Security::Agent::Control::GRPCContext.reset_context
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end

#remote_read_on_exit(retval) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/newrelic_security/instrumentation-security/grpc/server/instrumentation.rb', line 34

def remote_read_on_exit(retval)
  NewRelic::Security::Agent.logger.debug "OnExit :  #{self.class}.#{__method__}"
  ctxt = NewRelic::Security::Agent::Control::GRPCContext.get_context
  if ctxt
    if ctxt.[:reflectedMetaData][:isGrpcClientStream]
      ctxt.body << retval.to_json
    else
      ctxt.body += retval.to_json
    end
    ctxt.[:reflectedMetaData][:inputClass] = retval.class.name
  end
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end