Module: Atatus::Spies::RakeSpy::Ext Private

Defined in:
lib/atatus/spies/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.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/atatus/spies/rake.rb', line 27

def execute(*args)
  agent = Atatus.start

  unless agent && agent.config.instrumented_rake_tasks.include?(name)
    return super(*args)
  end

  transaction =
    Atatus.start_transaction("Rake::Task[#{name}]", 'Rake')

  begin
    result = super(*args)

    transaction&.result = 'success'
    transaction&.outcome = Transaction::Outcome::SUCCESS
  rescue StandardError => e
    transaction&.result = 'error'
    transaction&.outcome = Transaction::Outcome::FAILURE
    Atatus.report(e)

    raise
  ensure
    Atatus.end_transaction
    Atatus.stop
  end

  result
end