Class: Sentry::Gruf::ClientInterceptor

Inherits:
Gruf::Interceptors::ClientInterceptor
  • Object
show all
Defined in:
lib/sentry/gruf/client_interceptor.rb

Overview

Interceptor for the Gruf client. Please note that the interceptor itself does not send errors to Sentry. It simply tags some information about the last request made through the client. Just add this interceptor to the array of used interceptors as the first element.

Examples:

Use client interceptor

client = ::Gruf::Client.new(
  service: Some::Service,
  client_options: {
    interceptors: [Sentry::Gruf::ClientInterceptor.new, OtherInterceptors.new]
  }
)

Instance Method Summary collapse

Instance Method Details

#call(request_context:) ⇒ Object

Parameters:

  • request_context (Gruf::Outbound::RequestContext)


18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sentry/gruf/client_interceptor.rb', line 18

def call(request_context:)
  ::Sentry.configure_scope do |scope|
    scope.set_tags(
      grpc_method_name: request_context.method_name,
      grpc_route_key: request_context.route_key,
      grpc_call_type: request_context.type,
    )
  end

  yield
end