Class: Phlex::Reactive::APM::Sentry

Inherits:
Adapter
  • Object
show all
Defined in:
lib/phlex/reactive/apm/sentry.rb

Overview

Sentry adapter (issue #207). Activates only when ::Sentry is loaded AND initialized. Sentry's chief value here is error reporting: an action-body crash is captured WITH component/action tags. record_action names the transaction on the current scope for the successful path.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Adapter

#transaction_name

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
# File 'lib/phlex/reactive/apm/sentry.rb', line 11

def self.available?
  return false unless defined?(::Sentry) && ::Sentry.respond_to?(:initialized?)

  ::Sentry.initialized?
end

Instance Method Details

#record_action(payload, _duration_ms) ⇒ Object



17
18
19
20
21
22
# File 'lib/phlex/reactive/apm/sentry.rb', line 17

def record_action(payload, _duration_ms)
  name = transaction_name(payload)
  return unless name

  ::Sentry.configure_scope { it.set_transaction_name(name) }
end

#record_error(error, payload) ⇒ Object



24
25
26
# File 'lib/phlex/reactive/apm/sentry.rb', line 24

def record_error(error, payload)
  ::Sentry.capture_exception(error, tags: tags(payload))
end