Module: NewRelic::Agent::Instrumentation::GRPC::Helper

Included in:
Client, Server
Defined in:
lib/new_relic/agent/instrumentation/grpc/helper.rb

Constant Summary collapse

NR_8T_HOST_PATTERN =
%r{tracing\.(?:staging-)?edge\.nr-data}.freeze

Instance Method Summary collapse

Instance Method Details

#cleaned_method(method) ⇒ Object



12
13
14
15
16
17
# File 'lib/new_relic/agent/instrumentation/grpc/helper.rb', line 12

def cleaned_method(method)
  method = method.to_s unless method.is_a?(String)
  return method unless method.start_with?('/')

  method[1..-1]
end

#host_denylisted?(host) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
23
# File 'lib/new_relic/agent/instrumentation/grpc/helper.rb', line 19

def host_denylisted?(host)
  return false unless host

  ignore_patterns.any? { |regex| host.match?(regex) }
end

#ignore_patternsObject



25
26
27
# File 'lib/new_relic/agent/instrumentation/grpc/helper.rb', line 25

def ignore_patterns
  ([NR_8T_HOST_PATTERN] + NewRelic::Agent.config[:'instrumentation.grpc.host_denylist']).freeze
end