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

Defined in:
lib/newrelic_security/instrumentation-security/grpc/client/chain.rb

Class Method Summary collapse

Class Method Details

.instrument!Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/newrelic_security/instrumentation-security/grpc/client/chain.rb', line 6

def self.instrument!
  ::GRPC::ClientStub.class_eval do
    include NewRelic::Security::Instrumentation::GRPC::ClientStub

    alias_method :request_response_without_security, :request_response
    
    def request_response(method, req, marshal, unmarshal, deadline: nil, return_op: false, parent: nil, credentials: nil, metadata: {}) # rubocop:disable Metrics/ParameterLists
      retval = nil
      event = grpc_client_on_enter(method, ) { retval = request_response_without_security(method, req, marshal, unmarshal, deadline, return_op, parent, credentials, ) }
      grpc_client_on_exit(event) { return retval }
    end

    alias_method :server_streamer_without_security, :server_streamer

    def server_streamer(method, req, marshal, unmarshal, deadline: nil, return_op: false, parent: nil, credentials: nil, metadata: {}, &blk) # rubocop:disable Metrics/ParameterLists
      retval = nil
      event = grpc_client_on_enter(method, ) { retval = server_streamer_without_security(method, req, marshal, unmarshal, deadline, return_op, parent, credentials, , &blk) }
      grpc_client_on_exit(event) { return retval }
    end

    alias_method :client_streamer_without_security, :client_streamer

    def client_streamer(method, requests, marshal, unmarshal, deadline: nil, return_op: false, parent: nil, credentials: nil, metadata: {}) # rubocop:disable Metrics/ParameterLists
      retval = nil
      event = grpc_client_on_enter(method, ) { retval = client_streamer_without_security(method, requests, marshal, unmarshal, deadline, return_op, parent, credentials, ) }
      grpc_client_on_exit(event) { return retval }
    end

    alias_method :bidi_streamer_without_security, :bidi_streamer

    def bidi_streamer(method, requests, marshal, unmarshal, deadline: nil, return_op: false, parent: nil, credentials: nil, metadata: {}, &blk) # rubocop:disable Metrics/ParameterLists
      retval = nil
      event = grpc_client_on_enter(method, ) { retval = bidi_streamer_without_security(method, requests, marshal, unmarshal, deadline, return_op, parent, credentials, , &blk) }
      grpc_client_on_exit(event) { return retval }
    end
  end
end