Class: Gruf::Sentry::ServerInterceptor
- Inherits:
-
Interceptors::ServerInterceptor
- Object
- Interceptors::ServerInterceptor
- Gruf::Sentry::ServerInterceptor
- Includes:
- ErrorParser
- Defined in:
- lib/gruf/sentry/server_interceptor.rb
Overview
Intercepts inbound calls to provide Sentry error reporting
Instance Method Summary collapse
-
#call(&_block) ⇒ Object
Handle the gruf around hook and capture errors.
Methods included from ErrorParser
#code_for, #error?, #error_classes
Instance Method Details
#call(&_block) ⇒ Object
Handle the gruf around hook and capture errors
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/gruf/sentry/server_interceptor.rb', line 29 def call(&_block) return yield if Gruf::Sentry.ignore_methods.include?(request.method_name) begin yield rescue StandardError, GRPC::BadStatus => e if error?(e) # only capture ::Sentry.configure_scope do |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, grpc_error_code: code_for(e), grpc_error_class: e.class.name) end ::Sentry.capture_exception(e) end raise # passthrough end end |