Class: Sentry::Gruf::ServerInterceptor
- Inherits:
-
Gruf::Interceptors::ServerInterceptor
- Object
- Gruf::Interceptors::ServerInterceptor
- Sentry::Gruf::ServerInterceptor
- Defined in:
- lib/sentry/gruf/server_interceptor.rb
Overview
Interceptor for Gruf wrapper of gRPC server. It handles all uncaught exceptions and sent them to the Sentry. Add this interceptor to the begining of interceptors stack.
Instance Method Summary collapse
-
#call { ... } ⇒ Object
Required method by Gruf interceptor specification.
Instance Method Details
#call { ... } ⇒ Object
Required method by Gruf interceptor specification.
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 |
# File 'lib/sentry/gruf/server_interceptor.rb', line 17 def call # make sure the current thread has a clean hub Sentry.clone_hub_to_current_thread Sentry.with_scope do |scope| scope. scope.set_transaction_name(request.service_key) scope.( grpc_method: request.method_key, grpc_request_class: request.request_class.name, grpc_service_key: request.service_key, ) begin yield rescue Exception => e sensitive_grpc_codes = [:sensitive_grpc_codes] || [] raise if e.is_a?(GRPC::BadStatus) && !sensitive_grpc_codes.include?(e.code.to_s) ::Sentry::Gruf.capture_exception(e) raise end end end |