Class: InnerPerformance::CurrentRequest
- Inherits:
-
Object
- Object
- InnerPerformance::CurrentRequest
- Defined in:
- lib/inner_performance/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.
-
#traces ⇒ Object
readonly
Returns the value of attribute traces.
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/inner_performance/current_request.rb', line 25 def initialize(request_id) @request_id = request_id @traces = [] @ignore = Set.new @data = nil @record = nil end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
8 9 10 |
# File 'lib/inner_performance/current_request.rb', line 8 def data @data end |
#ignore ⇒ Object (readonly)
Returns the value of attribute ignore.
7 8 9 |
# File 'lib/inner_performance/current_request.rb', line 7 def ignore @ignore end |
#record ⇒ Object
Returns the value of attribute record.
9 10 11 |
# File 'lib/inner_performance/current_request.rb', line 9 def record @record end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
7 8 9 |
# File 'lib/inner_performance/current_request.rb', line 7 def request_id @request_id end |
#traces ⇒ Object (readonly)
Returns the value of attribute traces.
7 8 9 |
# File 'lib/inner_performance/current_request.rb', line 7 def traces @traces end |
Class Method Details
.cleanup ⇒ Object
20 21 22 |
# File 'lib/inner_performance/current_request.rb', line 20 def cleanup Thread.current[:ip_current_request] = nil end |
.current ⇒ Object
16 17 18 |
# File 'lib/inner_performance/current_request.rb', line 16 def current CurrentRequest.init end |
.init ⇒ Object
12 13 14 |
# File 'lib/inner_performance/current_request.rb', line 12 def init Thread.current[:ip_current_request] ||= CurrentRequest.new(SecureRandom.hex(16)) end |
Instance Method Details
#trace(options = {}) ⇒ Object
33 34 35 |
# File 'lib/inner_performance/current_request.rb', line 33 def trace( = {}) @traces << .merge(time: Time.current) end |