module Airbrake

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

# sig/airbrake-ruby.rbs

module Airbrake
  def notify_performance_breakdown: (Hash breakdown_info, ?Hash stash) -> untyped
  def notify_query: (Hash query_info, ?Hash stash) -> untyped
  def notify_request: (Hash request_info, ?Hash stash) -> untyped
  def performance_notifier: () -> untyped
end

def add_filter(filter = nil, &block)

Returns:
  • (void) -

Other tags:
    Yieldreturn: -

Other tags:
    Yieldparam: -

Other tags:
    Yield: - The notice to filter

Parameters:
  • filter (#call) -- The filter object

Other tags:
    Example: Ignore with help of a class -
    Example: Ignore based on some condition -
    Example: Ignore all notices -
def add_filter(filter = nil, &block)
  notice_notifier.add_filter(filter, &block)
end

def add_performance_filter(filter = nil, &block)

Other tags:
    See: Airbrake::PerformanceNotifier#add_filter -

Other tags:
    Since: - v3.2.0

Returns:
  • (void) -

Other tags:
    Yieldreturn: -

Other tags:
    Yieldparam: -

Other tags:
    Yield: - The metric to filter

Parameters:
  • filter (#call) -- The filter object

Other tags:
    Example: Filter with help of a class -
    Example: Filter sensitive data -
    Example: Ignore all metrics -
def add_performance_filter(filter = nil, &block)
  performance_notifier.add_filter(filter, &block)
end

def build_notice(exception, params = {})

Returns:
  • (Airbrake::Notice) - the notice built with help of the given

Parameters:
  • params (Hash) -- The additional params attached to the notice
  • exception (Exception) -- The exception on top of which the notice
def build_notice(exception, params = {})
  notice_notifier.build_notice(exception, params)
end

def close

Returns:
  • (nil) -
def close
  if defined?(@notice_notifier) && @notice_notifier
    @notice_notifier.close
  end
  if defined?(@performance_notifier) && @performance_notifier
    @performance_notifier.close
  end
  if defined?(@remote_settings) && @remote_settings
    @remote_settings.stop_polling
  end
  nil
end

def configure

Returns:
  • (void) -

Other tags:
    Yieldparam: config -

Other tags:
    Yield: -
def configure
  yield config = Airbrake::Config.instance
  Airbrake::Loggable.instance = config.logger
  config_processor = Airbrake::Config::Processor.new(config)
  config_processor.process_blocklist(notice_notifier)
  config_processor.process_allowlist(notice_notifier)
  @remote_settings ||= config_processor.process_remote_configuration
  config_processor.add_filters(notice_notifier)
end

def configured?

Other tags:
    Since: - v2.3.0

Returns:
  • (Boolean) - true if the notifier was configured, false otherwise
def configured?
  @notice_notifier && @notice_notifier.configured?
end

def delete_filter(filter_class)

Other tags:
    Note: - This method cannot delete filters assigned via the Proc form.

Other tags:
    Since: - v3.1.0

Returns:
  • (void) -

Parameters:
  • filter_class (Class) -- The class of the filter you want to delete
def delete_filter(filter_class)
  notice_notifier.delete_filter(filter_class)
end

def delete_performance_filter(filter_class)

Other tags:
    See: Airbrake::PerformanceNotifier#delete_filter -

Other tags:
    Note: - This method cannot delete filters assigned via the Proc form.

Other tags:
    Since: - v3.2.0

Returns:
  • (void) -

Parameters:
  • filter_class (Class) -- The class of the filter you want to delete
def delete_performance_filter(filter_class)
  performance_notifier.delete_filter(filter_class)
end

def deploy_notifier

Other tags:
    Api: - private

Other tags:
    Since: - v4.2.3
def deploy_notifier
  @deploy_notifier ||= DeployNotifier.new
end

def merge_context(context)

Returns:
  • (void) -

Parameters:
  • context (Hash{Symbol=>Object}) --
def merge_context(context)
  notice_notifier.merge_context(context)
end

def notice_notifier

Other tags:
    Api: - private

Other tags:
    Since: - v4.2.3
def notice_notifier
  @notice_notifier ||= NoticeNotifier.new
end

def notify(exception, params = {}, &block)

Other tags:
    See: .notify_sync -

Returns:
  • (Airbrake::Promise) -

Other tags:
    Yieldreturn: -

Other tags:
    Yieldparam: -

Other tags:
    Yield: - The notice to filter

Parameters:
  • params (Hash) -- The additional payload to be sent to Airbrake. Can
  • exception (Exception, String, Airbrake::Notice) -- The exception to be

Other tags:
    Example: Sending a Notice -
    Example: Sending a string -
    Example: Sending an exception -
def notify(exception, params = {}, &block)
  notice_notifier.notify(exception, params, &block)
end

def notify_deploy(deploy_info)

Returns:
  • (void) -

Options Hash: (**deploy_info)
  • :version (Symbol) --
  • :revision (Symbol) --
  • :repository (Symbol) --
  • :username (Symbol) --
  • :environment (Symbol) --

Parameters:
  • deploy_info (Hash{Symbol=>String}) -- The params for the API
def notify_deploy(deploy_info)
  deploy_notifier.notify(deploy_info)
end

def notify_performance_breakdown(breakdown_info, stash = {})

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

def notify_performance_breakdown: (method | String | route | String | response_type | Symbol | groups | db | Float | view | Float | timing | Float | time | Float breakdown_info, ?request | ActionDispatch::Request | user | id | String | name | String | email | String stash) -> untyped

This signature was generated using 1 sample from 1 application.

Other tags:
    Since: - v4.2.0

Returns:
  • (void) -

Parameters:
  • stash (Hash) -- What needs to be appeneded to the stash, so it's
  • breakdown_info (Hash{Symbol=>Object}) --

Options Hash: (**breakdown_info)
  • :timing (Float) -- How much time it took to process
  • :groups (ArrayFloat}>) --
  • :response_type (String) --
  • :route (String) --
  • :method (String) -- HTTP method
def notify_performance_breakdown(breakdown_info, stash = {})
  performance_breakdown = PerformanceBreakdown.new(**breakdown_info)
  performance_breakdown.stash.merge!(stash)
  performance_notifier.notify(performance_breakdown)
end

def notify_performance_breakdown_sync(breakdown_info, stash = {})

Other tags:
    See: .notify_performance_breakdown -

Other tags:
    Since: - v4.10.0
def notify_performance_breakdown_sync(breakdown_info, stash = {})
  performance_breakdown = PerformanceBreakdown.new(**breakdown_info)
  performance_breakdown.stash.merge!(stash)
  performance_notifier.notify_sync(performance_breakdown)
end

def notify_query(query_info, stash = {})

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

def notify_query: (route | String | method | String | query | String | func | String | file | String | line | Integer | timing | Float | time | Float query_info, ? stash) -> untyped

This signature was generated using 1 sample from 1 application.

Other tags:
    See: Airbrake::PerformanceNotifier#notify -

Other tags:
    Since: - v3.2.0

Returns:
  • (void) -

Parameters:
  • stash (Hash) -- What needs to be appeneded to the stash, so it's
  • query_info (Hash{Symbol=>Object}) --

Options Hash: (**query_info)
  • :timing (Float) -- How much time it took to process the
  • :line (Integer) -- The line that executes the query
  • :file (String) -- The file that has the function that
  • :func (String) -- The function that called the query
  • :query (String) -- The query that was executed
  • :route (String) -- The route that triggered this SQL
  • :method (String) -- The HTTP method that triggered this
def notify_query(query_info, stash = {})
  query = Query.new(**query_info)
  query.stash.merge!(stash)
  performance_notifier.notify(query)
end

def notify_query_sync(query_info, stash = {})

Other tags:
    See: .notify_query -

Other tags:
    Since: - v4.10.0
def notify_query_sync(query_info, stash = {})
  query = Query.new(**query_info)
  query.stash.merge!(stash)
  performance_notifier.notify_sync(query)
end

def notify_queue(queue_info, stash = {})

Other tags:
    See: .notify_queue_sync -

Other tags:
    Since: - v4.9.0

Returns:
  • (void) -

Parameters:
  • stash (Hash) -- What needs to be appended to the stash, so it's
  • queue_info (Hash{Symbol=>Object}) --

Options Hash: (**breakdown_info)
  • :timing (Float) -- How much time it took to process
  • :groups (ArrayFloat}>) -- Where the job
  • :error_count (Integer) -- How many times this worker
  • :queue (String) -- The name of the queue/worker
def notify_queue(queue_info, stash = {})
  queue = Queue.new(**queue_info)
  queue.stash.merge!(stash)
  performance_notifier.notify(queue)
end

def notify_queue_sync(queue_info, stash = {})

Other tags:
    See: .notify_queue -

Other tags:
    Since: - v4.10.0
def notify_queue_sync(queue_info, stash = {})
  queue = Queue.new(**queue_info)
  queue.stash.merge!(stash)
  performance_notifier.notify_sync(queue)
end

def notify_request(request_info, stash = {})

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

def notify_request: (method | String | route | String | status_code | Integer | timing | Float | time | Float request_info, ? stash) -> untyped

This signature was generated using 1 sample from 1 application.

Other tags:
    See: Airbrake::PerformanceNotifier#notify -

Other tags:
    Since: - v3.0.0

Returns:
  • (void) -

Parameters:
  • stash (Hash) -- What needs to be appeneded to the stash, so it's
  • request_info (Hash{Symbol=>Object}) --

Options Hash: (**request_info)
  • :timing (Float) -- How much time it took to process the
  • :status_code (Integer) -- The response code that the
  • :route (String) -- The route that was invoked
  • :method (String) -- The HTTP method that was invoked
def notify_request(request_info, stash = {})
  request = Request.new(**request_info)
  request.stash.merge!(stash)
  performance_notifier.notify(request)
end

def notify_request_sync(request_info, stash = {})

Other tags:
    See: .notify_request -

Other tags:
    Since: - v4.10.0
def notify_request_sync(request_info, stash = {})
  request = Request.new(**request_info)
  request.stash.merge!(stash)
  performance_notifier.notify_sync(request)
end

def notify_sync(exception, params = {}, &block)

Other tags:
    See: .notify -

Returns:
  • (Airbrake::Promise) - the reponse from the server

Other tags:
    Yieldreturn: -

Other tags:
    Yieldparam: -

Other tags:
    Yield: - The notice to filter

Parameters:
  • params (Hash) -- The additional payload to be sent to Airbrake. Can
  • exception (Exception, String, Airbrake::Notice) -- The exception to be
def notify_sync(exception, params = {}, &block)
  notice_notifier.notify_sync(exception, params, &block)
end

def performance_notifier

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

def performance_notifier: () -> untyped

This signature was generated using 3 samples from 1 application.

Other tags:
    Api: - private

Other tags:
    Since: - v4.2.3
def performance_notifier
  @performance_notifier ||= PerformanceNotifier.new
end

def reset

Other tags:
    Since: - v4.2.2

Returns:
  • (void) -
def reset
  close
  self.performance_notifier = PerformanceNotifier.new
  self.notice_notifier = NoticeNotifier.new
  self.deploy_notifier = DeployNotifier.new
end