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

Includes:
Helper
Included in:
RpcDescPrepend, RpcServerPrepend
Defined in:
lib/new_relic/agent/instrumentation/grpc/server/chain.rb,
lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb,
lib/new_relic/agent/instrumentation/grpc/server/rpc_desc_prepend.rb,
lib/new_relic/agent/instrumentation/grpc/server/rpc_server_prepend.rb

Defined Under Namespace

Modules: Chain, RpcDescPrepend, RpcServerPrepend

Constant Summary collapse

INSTRUMENTATION_NAME =
'gRPC_Server'
DT_KEYS =
[NewRelic::NEWRELIC_KEY, NewRelic::TRACEPARENT_KEY, NewRelic::TRACESTATE_KEY].freeze
INSTANCE_VAR_HOST =
:@host_nr
INSTANCE_VAR_PORT =
:@port_nr
INSTANCE_VAR_METHOD =
:@method_nr
CATEGORY =
:web
DESTINATIONS =
AttributeFilter::DST_TRANSACTION_TRACER |
AttributeFilter::DST_TRANSACTION_EVENTS |
AttributeFilter::DST_ERROR_COLLECTOR

Constants included from Helper

Helper::NR_8T_HOST_PATTERN

Instance Method Summary collapse

Methods included from Helper

#cleaned_method, #host_denylisted?, #ignore_patterns

Instance Method Details

#add_http2_port_with_tracing(*args) ⇒ Object



47
48
49
50
# File 'lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb', line 47

def add_http2_port_with_tracing(*args)
  set_host_and_port_on_server_instance(args.first)
  yield
end

#handle_with_tracing(streamer_type, active_call, mth, _inter_ctx) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb', line 25

def handle_with_tracing(streamer_type, active_call, mth, _inter_ctx)
  return yield unless trace_with_newrelic?

  NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME)

   = (active_call)
  txn = NewRelic::Agent::Transaction.start_new_transaction(NewRelic::Agent::Tracer.state,
    CATEGORY,
    trace_options)
  add_attributes(txn, , streamer_type)
  process_distributed_tracing_headers()

  begin
    yield
  rescue => e
    NewRelic::Agent.notice_error(e)
    raise
  end
ensure
  txn&.finish
end

#run_with_tracing(*args) ⇒ Object



52
53
54
55
# File 'lib/new_relic/agent/instrumentation/grpc/server/instrumentation.rb', line 52

def run_with_tracing(*args)
  set_host_and_port_and_method_info_on_desc
  yield
end