Class: Appsignal::Integrations::Railtie Private

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/appsignal/integrations/railtie.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

Class Method Details

.add_instrumentation_middleware(app) ⇒ 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.



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/appsignal/integrations/railtie.rb', line 58

def self.add_instrumentation_middleware(app)
  app.middleware.insert(
    0,
    ::Rack::Events,
    [Appsignal::Rack::EventHandler.new]
  )
  app.middleware.insert_after(
    ActionDispatch::DebugExceptions,
    Appsignal::Rack::RailsInstrumentation
  )
end

.after_initialize(app) ⇒ 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.



38
39
40
# File 'lib/appsignal/integrations/railtie.rb', line 38

def self.after_initialize(app)
  Appsignal::Integrations::Railtie.start if app.config.appsignal.start_at == :after_initialize
end

.initialize_error_reporterObject

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.



70
71
72
73
74
75
# File 'lib/appsignal/integrations/railtie.rb', line 70

def self.initialize_error_reporter
  return unless Appsignal.config[:enable_rails_error_reporter]
  return unless Rails.respond_to?(:error)

  Rails.error.subscribe(Appsignal::Integrations::RailsErrorReporterSubscriber)
end

.load_default_configObject

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.



42
43
44
45
46
47
48
49
50
51
# File 'lib/appsignal/integrations/railtie.rb', line 42

def self.load_default_config
  Appsignal::Config.add_loader_defaults(
    :rails,
    :root_path => Rails.root,
    :env => Rails.env,
    :name => Appsignal::Utils::RailsHelper.detected_rails_app_name,
    :log_path => Rails.root.join("log"),
    :ignore_actions => ["Rails::HealthController#show"]
  )
end

.on_load(app) ⇒ 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.



29
30
31
32
33
34
35
36
# File 'lib/appsignal/integrations/railtie.rb', line 29

def self.on_load(app)
  load_default_config
  Appsignal::Integrations::Railtie.add_instrumentation_middleware(app)

  return unless app.config.appsignal.start_at == :on_load

  Appsignal::Integrations::Railtie.start
end

.startObject

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.



53
54
55
56
# File 'lib/appsignal/integrations/railtie.rb', line 53

def self.start
  Appsignal.start
  initialize_error_reporter if Appsignal.started?
end