Class: ScoutApm::RequestManager
- Inherits:
-
Object
- Object
- ScoutApm::RequestManager
- Defined in:
- lib/scout_apm/request_manager.rb
Class Method Summary collapse
-
.create ⇒ Object
Create a new TrackedRequest object for this thread.
-
.find ⇒ Object
Get the current Thread local, and detecting, and not returning a stale request.
- .lookup ⇒ Object
Class Method Details
.create ⇒ Object
Create a new TrackedRequest object for this thread
22 23 24 25 26 27 28 29 30 |
# File 'lib/scout_apm/request_manager.rb', line 22 def self.create store = if ScoutApm::Agent.instance.apm_enabled? ScoutApm::Agent.instance.store else ScoutApm::FakeStore.new end Thread.current[:scout_request] = TrackedRequest.new(store) end |
.find ⇒ Object
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 |
.lookup ⇒ Object
6 7 8 |
# File 'lib/scout_apm/request_manager.rb', line 6 def self.lookup find || create end |