Class: HeimdallApm::TransactionManager

Inherits:
Object
  • Object
show all
Defined in:
lib/heimdall_apm/transaction_manager.rb

Overview

Handles the thread-local variable holding the current tracked transaction, populating it the first time it is accessed.

Class Method Summary collapse

Class Method Details

.createObject



22
23
24
25
# File 'lib/heimdall_apm/transaction_manager.rb', line 22

def self.create
  context = Agent.instance.context
  Thread.current[:heimdall_request] = ::HeimdallApm::TrackedTransaction.new(context)
end

.currentObject



8
9
10
# File 'lib/heimdall_apm/transaction_manager.rb', line 8

def self.current
  find || create
end

.findObject



12
13
14
15
16
17
18
19
20
# File 'lib/heimdall_apm/transaction_manager.rb', line 12

def self.find
  req = Thread.current[:heimdall_request]

  if !req || req.stopped?
    nil
  else
    req
  end
end