Class: THTP::Server::Instrumentation::Sentry

Inherits:
Object
  • Object
show all
Defined in:
lib/thtp/server/instrumentation.rb

Overview

Captures exceptions to Sentry

Instance Method Summary collapse

Constructor Details

#initialize(raven) ⇒ Sentry

Returns a new instance of Sentry.

Parameters:

  • raven (Raven)

    A Sentry client instance, or something that acts like one



196
197
198
# File 'lib/thtp/server/instrumentation.rb', line 196

def initialize(raven)
  @raven = raven
end

Instance Method Details

#internal_error(request:, error:, time:) ⇒ Object

An unknown error occurred

Parameters:

  • request (Rack::Request)

    The inbound HTTP request

  • error (Exception)

    The to-be-serialized exception

  • time (Integer)

    Milliseconds of execution wall time



214
215
216
# File 'lib/thtp/server/instrumentation.rb', line 214

def internal_error(request:, error:, time:)
  @raven.capture_exception(error, **http_context(request))
end

#rpc_error(request:, rpc:, args:, error:, time:) ⇒ Object

Handler raised an unexpected error

Parameters:

  • request (Rack::Request)

    The inbound HTTP request

  • rpc (Symbol)

    The name of the RPC

  • args (Thrift::Struct?)

    The deserialized thrift args

  • error (THTP::ServerError)

    The to-be-serialized exception

  • time (Integer)

    Milliseconds of execution wall time



206
207
208
# File 'lib/thtp/server/instrumentation.rb', line 206

def rpc_error(request:, rpc:, args:, error:, time:)
  @raven.capture_exception(error, **rpc_context(request, rpc, args))
end