Module: NewRelic::Security::Instrumentation::GRPC::ClientStub

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

Defined Under Namespace

Modules: Chain, Prepend

Instance Method Summary collapse

Instance Method Details

#grpc_client_on_enter(method, metadata) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/newrelic_security/instrumentation-security/grpc/client/instrumentation.rb', line 8

def grpc_client_on_enter(method, )
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  host = "grpc://#{instance_variable_get(:@host)}#{method}"
  # TODO: Recheck this parameters, this is diff for other LCs
  event = NewRelic::Security::Agent::Control::Collector.collect(HTTP_REQUEST, [{:host => host, :path => SLASH}])
  # TODO: tracing data is required only in microservices, currently add_tracing_data data causing issues in gRPC.
  # NewRelic::Security::Instrumentation::InstrumentationUtils.add_tracing_data(metadata, event) if event
  event
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
  return event
end

#grpc_client_on_exit(event) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/newrelic_security/instrumentation-security/grpc/client/instrumentation.rb', line 24

def grpc_client_on_exit(event)
  NewRelic::Security::Agent.logger.debug "OnExit :  #{self.class}.#{__method__}"
  NewRelic::Security::Agent::Utils.create_exit_event(event)
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end