Class: Honeybadger::Plugins::RailsBreadcrumbs Private
- Inherits:
-
Object
- Object
- Honeybadger::Plugins::RailsBreadcrumbs
- Defined in:
- lib/honeybadger/plugins/breadcrumbs.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
-
.send_breadcrumb_notification(name, duration, notification_config, data = {}) ⇒ Object
private
Used internally for sending out Rails Instrumentation breadcrumbs.
- .subscribe_to_notification(name, notification_config) ⇒ Object private
Class Method Details
.send_breadcrumb_notification(name, duration, notification_config, data = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Used internally for sending out Rails Instrumentation breadcrumbs.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/honeybadger/plugins/breadcrumbs.rb', line 79 def self.(name, duration, notification_config, data = {}) return if notification_config[:exclude_when]&.call(data) = case (m = notification_config[:message]) when Proc m.call(data) when String m else name end data = data.slice(*notification_config[:select_keys]) if notification_config[:select_keys] data = notification_config[:transform].call(data) if notification_config[:transform] data = data.is_a?(Hash) ? data : {} data[:duration] = duration if duration Honeybadger.( , category: notification_config[:category] || :custom, metadata: data ) rescue => e # Instrumentation must never break the instrumented code. Honeybadger.config.logger.error("Error in Honeybadger breadcrumb for #{name}: #{e.class}: #{e.}") end |
.subscribe_to_notification(name, notification_config) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
109 110 111 112 113 114 115 |
# File 'lib/honeybadger/plugins/breadcrumbs.rb', line 109 def self.subscribe_to_notification(name, notification_config) ActiveSupport::Notifications.subscribe(name) do |_, started, finished, _, data| duration = finished - started if finished && started (name, duration, notification_config, data) end end |