class Airbrake::Config

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/airbrake-ruby/config.rbs

class Airbrake::Config
  def check_configuration: () -> untyped
  def check_notify_ability: () -> untyped
  def instance: () -> untyped
  def validate: () -> untyped
end

@since v1.0.0
@api public
can use to configure an Airbrake instance.
Represents the Airbrake config. A config contains all the options that you

def check_configuration

Experimental RBS support (using type sampling data from the type_fusion project).

def check_configuration: () -> untyped

This signature was generated using 4 samples from 1 application.

Returns:
  • (Promise) - resolved promise if config is valid & can notify,
def check_configuration
  promise = validate
  return promise if promise.rejected?
  check_notify_ability
end

def check_notify_ability

Experimental RBS support (using type sampling data from the type_fusion project).

def check_notify_ability: () -> untyped

This signature was generated using 6 samples from 1 application.

Other tags:
    See: Validator.check_notify_ability -

Returns:
  • (Promise) -
def check_notify_ability
  Validator.check_notify_ability(self)
end

def check_performance_options(metric)

Returns:
  • (Promise) - resolved promise if neither of the performance options
def check_performance_options(metric)
  promise = Airbrake::Promise.new
  if !performance_stats
    promise.reject("The Performance Stats feature is disabled")
  elsif metric.is_a?(Airbrake::Query) && !query_stats
    promise.reject("The Query Stats feature is disabled")
  elsif metric.is_a?(Airbrake::Queue) && !job_stats
    promise.reject("The Job Stats feature is disabled")
  else
    promise
  end
end

def error_endpoint

Returns:
  • (URI) - the endpoint address
def error_endpoint
  @error_endpoint ||=
    begin
      self.error_host = ('https://' << error_host) if error_host !~ %r{\Ahttps?://}
      api = "api/v3/projects/#{project_id}/notices"
      URI.join(error_host, api)
    end
end

def host

def host
  logger.warn(HOST_DEPRECATION_MSG)
  @error_host
end

def host=(value)

def host=(value)
  logger.warn(HOST_DEPRECATION_MSG)
  @error_host = value
end

def ignored_environment?

Returns:
  • (Boolean) - true if the config ignores current environment, false
def ignored_environment?
  check_notify_ability.rejected?
end

def initialize(user_config = {})

Parameters:
  • user_config (Hash{Symbol=>Object}) -- the hash to be used to build the
def initialize(user_config = {})
  self.proxy = {}
  self.queue_size = 100
  self.workers = 1
  self.code_hunks = true
  self.logger = ::Logger.new(File::NULL).tap { |l| l.level = Logger::WARN }
  self.project_id = user_config[:project_id]
  self.project_key = user_config[:project_key]
  self.error_host = self.apm_host = 'https://api.airbrake.io'
  self.remote_config_host = 'https://notifier-configs.airbrake.io'
  self.ignore_environments = []
  self.timeout = user_config[:timeout]
  self.blocklist_keys = []
  self.allowlist_keys = []
  self.root_directory = File.realpath(
    (defined?(Bundler) && Bundler.root) ||
    Dir.pwd,
  )
  self.versions = {}
  self.performance_stats = true
  self.performance_stats_flush_period = 15
  self.query_stats = true
  self.job_stats = true
  self.error_notifications = true
  self.remote_config = true
  self.backlog = true
  merge(user_config)
end

def instance

Experimental RBS support (using type sampling data from the type_fusion project).

def instance: () -> untyped

This signature was generated using 23 samples from 1 application.

Returns:
  • (Config) -
def instance
  @instance ||= new
end

def logger=(logger)

Returns:
  • (Logger) - the logger
def logger=(logger)
  @logger = logger || @logger
end

def merge(config_hash)

Returns:
  • (self) - the merged config
def merge(config_hash)
  config_hash.each_pair { |option, value| set_option(option, value) }
  self
end

def set_option(option, value)

def set_option(option, value)
  __send__("#{option}=", value)
rescue NoMethodError
  raise Airbrake::Error, "unknown option '#{option}'"
end

def valid?

Returns:
  • (Boolean) - true if the config meets the requirements, false
def valid?
  validate.resolved?
end

def validate

Experimental RBS support (using type sampling data from the type_fusion project).

def validate: () -> untyped

This signature was generated using 6 samples from 1 application.

Other tags:
    See: Validator.validate -

Returns:
  • (Promise) -
def validate
  Validator.validate(self)
end