Module: Prosody::SentryIntegration
- Defined in:
- lib/prosody/sentry.rb
Class Method Summary collapse
Class Method Details
.capture_exception(exception, context = {}) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/prosody/sentry.rb', line 25 def self.capture_exception(exception, context = {}) return unless enabled? ::Sentry.with_scope do |scope| scope.set_context("prosody", context) event_type = context[:event_type] scope.set_tag("prosody.event_type", event_type.to_s) if event_type ::Sentry.capture_exception(exception) end end |
.enabled? ⇒ Boolean
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/prosody/sentry.rb', line 5 def self.enabled? if ENV["SENTRY_DSN"] && !defined?(::Sentry) unless @warned_missing_gem @warned_missing_gem = true Prosody.logger.error("SENTRY_DSN is set but sentry-ruby is not installed. Add `gem 'sentry-ruby'` to your Gemfile.") end return false end return false unless defined?(::Sentry) unless ::Sentry.initialized? return false unless ENV["SENTRY_DSN"] ::Sentry.init { |c| c.dsn = ENV["SENTRY_DSN"] } end ::Sentry.initialized? end |