Class: Appsignal::Integrations::RailsErrorReporterSubscriber Private

Inherits:
Object
  • Object
show all
Defined in:
lib/appsignal/integrations/railtie.rb

Overview

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.

Report errors reported by the Rails error reporter using Appsignal.report_error.

Class Method Summary collapse

Class Method Details

.report(error, handled:, severity:, context: {}, source: nil) ⇒ 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.

rubocop:disable Lint/UnusedMethodArgument



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/appsignal/integrations/railtie.rb', line 82

def report(error, handled:, severity:, context: {}, source: nil) # rubocop:disable Lint/UnusedMethodArgument
  return if ignored_error?(error)

  is_rails_runner = source == "application.runner.railties"
  namespace, action_name, tags, custom_data = context_for(context.dup)

  Appsignal.report_error(error) do |transaction|
    if namespace
      transaction.set_namespace(namespace)
    elsif is_rails_runner
      transaction.set_namespace("runner")
    end
    transaction.set_action(action_name) if action_name
    transaction.add_custom_data(custom_data) if custom_data

    tags[:reported_by] = :rails_error_reporter
    tags[:severity] = severity
    tags[:source] = source.to_s if source
    transaction.add_tags(tags)
  end
end