Module: Sentry::Rails::Breadcrumb::ActiveSupportLogger
- Extended by:
- Utils::HttpTracing
- Defined in:
- lib/sentry/rails/breadcrumb/active_support_logger.rb
Class Method Summary collapse
- .add(name, started, _finished, _unique_id, data) ⇒ Object
- .detach ⇒ Object
- .inject(allowed_keys) ⇒ Object
Class Method Details
.add(name, started, _finished, _unique_id, data) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sentry/rails/breadcrumb/active_support_logger.rb', line 11 def add(name, started, _finished, _unique_id, data) return unless Sentry.initialized? # skip Rails' internal events return if name.start_with?("!") if data.is_a?(Hash) data = data.slice(*@allowed_keys[name]) filter_data_collection!(data) end crumb = Sentry::Breadcrumb.new( data: data, category: name, timestamp: started.to_i ) Sentry.(crumb) end |
.detach ⇒ Object
41 42 43 |
# File 'lib/sentry/rails/breadcrumb/active_support_logger.rb', line 41 def detach ::ActiveSupport::Notifications.unsubscribe(@subscriber) end |
.inject(allowed_keys) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/sentry/rails/breadcrumb/active_support_logger.rb', line 30 def inject(allowed_keys) @allowed_keys = allowed_keys @subscriber = ::ActiveSupport::Notifications.subscribe(/.*/) do |name, started, finished, unique_id, data| # we only record events that has a started timestamp if started.is_a?(Time) add(name, started, finished, unique_id, data) end end end |