Module: NewRelic::Agent::Instrumentation::GRPC::Server::Chain

Defined in:
lib/new_relic/agent/instrumentation/grpc/server/chain.rb

Class Method Summary collapse

Class Method Details

.instrument!Object



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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/new_relic/agent/instrumentation/grpc/server/chain.rb', line 11

def self.instrument!
  # BEGIN RpcServer
  ::GRPC::RpcServer.class_eval do
    include NewRelic::Agent::Instrumentation::GRPC::Server

    def add_http2_port_with_newrelic_trace(*args)
      add_http2_port_with_tracing(*args) { add_http2_port_without_newrelic_trace(*args) }
    end

    alias add_http2_port_without_newrelic_trace add_http2_port
    alias add_http2_port add_http2_port_with_newrelic_trace

    def run_with_newrelic_trace(*args)
      run_with_tracing(*args) { run_without_newrelic_trace(*args) }
    end

    alias run_without_newrelic_trace run
    alias run run_with_newrelic_trace
    # END RpcServer
  end

  # BEGIN RpcDesc
  ::GRPC::RpcDesc.class_eval do
    include NewRelic::Agent::Instrumentation::GRPC::Server

    def handle_request_response_with_newrelic_trace(active_call, mth, inter_ctx)
      handle_with_tracing(:request_response, active_call, mth, inter_ctx) { handle_request_response_without_newrelic_trace(active_call, mth, inter_ctx) }
    end

    alias handle_request_response_without_newrelic_trace handle_request_response
    alias handle_request_response handle_request_response_with_newrelic_trace

    def handle_client_streamer_with_newrelic_trace(active_call, mth, inter_ctx)
      handle_with_tracing(:client_streamer, active_call, mth, inter_ctx) { handle_client_streamer_without_newrelic_trace(active_call, mth, inter_ctx) }
    end

    alias handle_client_streamer_without_newrelic_trace handle_client_streamer
    alias handle_client_streamer handle_client_streamer_with_newrelic_trace

    def handle_server_streamer_with_newrelic_trace(active_call, mth, inter_ctx)
      handle_with_tracing(:server_streamer, active_call, mth, inter_ctx) { handle_server_streamer_without_newrelic_trace(active_call, mth, inter_ctx) }
    end

    alias handle_server_streamer_without_newrelic_trace handle_server_streamer
    alias handle_server_streamer handle_server_streamer_with_newrelic_trace

    def handle_bidi_streamer_with_newrelic_trace(active_call, mth, inter_ctx)
      handle_with_tracing(:bidi_streamer, active_call, mth, inter_ctx) { handle_bidi_streamer_without_newrelic_trace(active_call, mth, inter_ctx) }
    end

    alias handle_bidi_streamer_without_newrelic_trace handle_bidi_streamer
    alias handle_bidi_streamer handle_bidi_streamer_with_newrelic_trace
    # END RpcDesc
  end
end