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 XXX: Figure out who is in charge of creating a ‘FakeStore` - previously was here



23
24
25
26
27
# File 'lib/scout_apm/request_manager.rb', line 23

def self.create
  agent_context = ScoutApm::Agent.instance.context
  store = agent_context.store
  Thread.current[:scout_request] = TrackedRequest.new(agent_context, store)
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.stopping? || 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