Class: ScoutApm::RequestManager

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/request_manager.rb

Class Method Summary collapse

Class Method Details

.createObject

Create a new TrackedRequest object for this thread



22
23
24
# File 'lib/scout_apm/request_manager.rb', line 22

def self.create
  Thread.current[:scout_request] = TrackedRequest.new
end

.findObject

Get the current Thread local, and detecting, and not returning a stale request



11
12
13
14
15
16
17
18
19
# File 'lib/scout_apm/request_manager.rb', line 11

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

  if req && req.recorded?
    nil
  else
    req
  end
end

.lookupObject



6
7
8
# File 'lib/scout_apm/request_manager.rb', line 6

def self.lookup
  find || create
end