Module: Appsignal::Integrations::RakeIntegration Private

Defined in:
lib/appsignal/integrations/rake.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Constant Summary collapse

IGNORED_ERRORS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

[
  # Normal exits from the application we do not need to report
  SystemExit,
  SignalException
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ignored_error?(error) ⇒ Boolean

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.

Returns:

  • (Boolean)
[View source]

13
14
15
# File 'lib/appsignal/integrations/rake.rb', line 13

def self.ignored_error?(error)
  IGNORED_ERRORS.include?(error.class)
end

Instance Method Details

#execute(*args) ⇒ 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.

[View source]

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/appsignal/integrations/rake.rb', line 17

def execute(*args)
  transaction =
    if Appsignal.config[:enable_rake_performance_instrumentation]
      Appsignal::Integrations::RakeIntegrationHelper.register_at_exit_hook
      _appsignal_create_transaction
    end

  Appsignal.instrument "task.rake" do
    super
  end
rescue Exception => error # rubocop:disable Lint/RescueException
  Appsignal::Integrations::RakeIntegrationHelper.register_at_exit_hook
  unless RakeIntegration.ignored_error?(error)
    transaction ||= _appsignal_create_transaction
    transaction.set_error(error)
  end
  raise error
ensure
  if transaction
    # Format given arguments and cast to hash if possible
    params, _ = args
    params = params.to_hash if params.respond_to?(:to_hash)
    transaction.set_action(name)
    transaction.add_params_if_nil(params)
    transaction.complete
  end
end