Module: NewRelic::Agent::Instrumentation::GRPC::Client
- Includes:
- Helper
- Included in:
- Prepend
- Defined in:
- lib/new_relic/agent/instrumentation/grpc/client/chain.rb,
lib/new_relic/agent/instrumentation/grpc/client/prepend.rb,
lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb,
lib/new_relic/agent/instrumentation/grpc/client/request_wrapper.rb
Defined Under Namespace
Modules: Chain, Prepend Classes: RequestWrapper
Constant Summary collapse
- INSTRUMENTATION_NAME =
'gRPC_Client'
Constants included from Helper
Instance Method Summary collapse
Methods included from Helper
#cleaned_method, #host_denylisted?, #ignore_patterns
Instance Method Details
#issue_request_with_tracing(grpc_type, method, requests, marshal, unmarshal, deadline:, return_op:, parent:, credentials:, metadata:) ⇒ Object
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 |
# File 'lib/new_relic/agent/instrumentation/grpc/client/instrumentation.rb', line 17 def issue_request_with_tracing(grpc_type, method, requests, marshal, unmarshal, deadline:, return_op:, parent:, credentials:, metadata:) return yield unless trace_with_newrelic? NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME) segment = request_segment(method) request_wrapper = NewRelic::Agent::Instrumentation::GRPC::Client::RequestWrapper.new(@host) # do not insert CAT headers for gRPC requests https://github.com/newrelic/newrelic-ruby-agent/issues/1730 segment.add_request_headers(request_wrapper) unless CrossAppTracing.cross_app_enabled? .merge!(request_wrapper.instance_variable_get(:@newrelic_metadata)) = nil grpc_status = 0 NewRelic::Agent.disable_all_tracing do begin yield rescue => e NewRelic::Agent.notice_error(e) grpc_status, = (e) raise end end ensure add_attributes(segment, grpc_message: , grpc_status: grpc_status, grpc_type: grpc_type) ::NewRelic::Agent::Transaction::Segment.finish(segment) end |