Class: RailsRunner::Request
- Inherits:
-
Object
- Object
- RailsRunner::Request
- Includes:
- Beefcake::Message
- Defined in:
- lib/rails_runner/messages/request.rb
Instance Attribute Summary collapse
-
#notifications ⇒ Object
Returns the value of attribute notifications.
Instance Method Summary collapse
- #add_action(action) ⇒ Object
- #error? ⇒ Boolean
- #finish(error = false) ⇒ Object
- #finish_action(action) ⇒ Object
-
#initialize ⇒ Request
constructor
A new instance of Request.
- #traceable? ⇒ Boolean
Constructor Details
#initialize ⇒ Request
Returns a new instance of Request.
14 15 16 17 18 19 |
# File 'lib/rails_runner/messages/request.rb', line 14 def initialize @start = Util.time_in_usec @current_level = 0 @actions = [] @notifications = [] end |
Instance Attribute Details
#notifications ⇒ Object
Returns the value of attribute notifications.
12 13 14 |
# File 'lib/rails_runner/messages/request.rb', line 12 def notifications @notifications end |
Instance Method Details
#add_action(action) ⇒ Object
28 29 30 31 32 |
# File 'lib/rails_runner/messages/request.rb', line 28 def add_action(action) action.level = @current_level @current_level += 1 @actions << action end |
#error? ⇒ Boolean
44 45 46 |
# File 'lib/rails_runner/messages/request.rb', line 44 def error? @error end |
#finish(error = false) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/rails_runner/messages/request.rb', line 21 def finish(error = false) @end = Util.time_in_usec @duration = @end - @start @error = error Instrumenter.instance.publish(self) end |
#finish_action(action) ⇒ Object
34 35 36 37 38 |
# File 'lib/rails_runner/messages/request.rb', line 34 def finish_action(action) return unless action action.finish @current_level -= 1 end |
#traceable? ⇒ Boolean
40 41 42 |
# File 'lib/rails_runner/messages/request.rb', line 40 def traceable? name.blank? || error? end |