Class: Railswatch::CurrentRequest
- Inherits:
-
Object
- Object
- Railswatch::CurrentRequest
- Defined in:
- lib/railswatch/thread/current_request.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#ignore ⇒ Object
readonly
Returns the value of attribute ignore.
-
#record ⇒ Object
Returns the value of attribute record.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#tracings ⇒ Object
readonly
Returns the value of attribute tracings.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(request_id) ⇒ CurrentRequest
constructor
A new instance of CurrentRequest.
- #trace(options = {}) ⇒ Object
Constructor Details
#initialize(request_id) ⇒ CurrentRequest
Returns a new instance of CurrentRequest.
25 26 27 28 29 30 31 |
# File 'lib/railswatch/thread/current_request.rb', line 25 def initialize(request_id) @request_id = request_id @tracings = [] @ignore = Set.new @data = nil @record = nil end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
6 7 8 |
# File 'lib/railswatch/thread/current_request.rb', line 6 def data @data end |
#ignore ⇒ Object (readonly)
Returns the value of attribute ignore.
5 6 7 |
# File 'lib/railswatch/thread/current_request.rb', line 5 def ignore @ignore end |
#record ⇒ Object
Returns the value of attribute record.
6 7 8 |
# File 'lib/railswatch/thread/current_request.rb', line 6 def record @record end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
5 6 7 |
# File 'lib/railswatch/thread/current_request.rb', line 5 def request_id @request_id end |
#tracings ⇒ Object (readonly)
Returns the value of attribute tracings.
5 6 7 |
# File 'lib/railswatch/thread/current_request.rb', line 5 def tracings @tracings end |
Class Method Details
.cleanup ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/railswatch/thread/current_request.rb', line 16 def self.cleanup Railswatch.log( '----------------------------------------------------> ' \ "CurrentRequest.cleanup !!!!!!!!!!!! -------------------------\n\n" ) Railswatch.skip = false Thread.current[:rp_current_request] = nil end |
.current ⇒ Object
12 13 14 |
# File 'lib/railswatch/thread/current_request.rb', line 12 def self.current CurrentRequest.init end |
.init ⇒ Object
8 9 10 |
# File 'lib/railswatch/thread/current_request.rb', line 8 def self.init Thread.current[:rp_current_request] ||= CurrentRequest.new(SecureRandom.hex(16)) end |
Instance Method Details
#trace(options = {}) ⇒ Object
33 34 35 |
# File 'lib/railswatch/thread/current_request.rb', line 33 def trace( = {}) @tracings << .merge(time: Railswatch::Utils.time.to_i) end |