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.

Instance Method Summary collapse

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.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/appsignal/integrations/rake.rb', line 7

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
  transaction ||= _appsignal_create_transaction
  transaction.set_error(error)
  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