class Airbrake::RemoteSettings::Callback

Callback is a class that provides a callback for the config poller, which updates the local config according to the data.

@api private @since v5.0.2

Public Class Methods

new(config) click to toggle source
# File lib/airbrake-ruby/remote_settings/callback.rb, line 9
def initialize(config)
  @config = config
  @orig_error_notifications = config.error_notifications
  @orig_performance_stats = config.performance_stats
end

Public Instance Methods

call(data) click to toggle source

@param [Airbrake::RemoteSettings::SettingsData] data @return [void]

# File lib/airbrake-ruby/remote_settings/callback.rb, line 17
def call(data)
  @config.logger.debug do
    "#{LOG_LABEL} applying remote settings: #{data.to_h}"
  end

  @config.error_host = data.error_host if data.error_host
  @config.apm_host = data.apm_host if data.apm_host

  process_error_notifications(data)
  process_performance_stats(data)
end

Private Instance Methods

process_error_notifications(data) click to toggle source
# File lib/airbrake-ruby/remote_settings/callback.rb, line 31
def process_error_notifications(data)
  return unless @orig_error_notifications

  @config.error_notifications = data.error_notifications?
end
process_performance_stats(data) click to toggle source
# File lib/airbrake-ruby/remote_settings/callback.rb, line 37
def process_performance_stats(data)
  return unless @orig_performance_stats

  @config.performance_stats = data.performance_stats?
end