Class: LittleGhost::Instrumentation::Handle
- Inherits:
-
Object
- Object
- LittleGhost::Instrumentation::Handle
- Defined in:
- lib/little_ghost/instrumentation.rb
Overview
A Handle represents work between Instrumentation.start and #finish.
Non-detached handles are fiber-owned and must finish in LIFO order after their children. Detached handles may finish outside the creating fiber but still cannot finish while local children remain active.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Operation identity, inherited attributes, previous local handle, and monotonic start time.
-
#operation_id ⇒ Object
readonly
Operation identity, inherited attributes, previous local handle, and monotonic start time.
-
#parent_operation_id ⇒ Object
readonly
Operation identity, inherited attributes, previous local handle, and monotonic start time.
-
#payload ⇒ Object
readonly
Operation identity, inherited attributes, previous local handle, and monotonic start time.
-
#previous ⇒ Object
readonly
Operation identity, inherited attributes, previous local handle, and monotonic start time.
-
#started_at ⇒ Object
readonly
Operation identity, inherited attributes, previous local handle, and monotonic start time.
Instance Method Summary collapse
-
#active? ⇒ Boolean
Indicates whether this handle is still active.
-
#detached? ⇒ Boolean
Indicates whether this handle is outside the fiber-local operation stack.
-
#finish(**attributes) ⇒ Object
Completes this operation with additional attributes.
-
#initialize(bus, name, operation_id:, parent_operation_id:, local_parent:, previous:, payload:, started_at:, detached:) ⇒ Handle
constructor
:nodoc:.
-
#local_parent? ⇒ Boolean
Indicates whether the parent is another active handle on this bus.
-
#owner? ⇒ Boolean
Indicates whether this handle belongs to the current fiber.
Constructor Details
#initialize(bus, name, operation_id:, parent_operation_id:, local_parent:, previous:, payload:, started_at:, detached:) ⇒ Handle
:nodoc:
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/little_ghost/instrumentation.rb', line 63 def initialize(bus, name, operation_id:, parent_operation_id:, local_parent:, previous:, payload:, started_at:, detached:) # :nodoc: @bus = bus @name = name.to_sym @operation_id = operation_id @parent_operation_id = parent_operation_id @local_parent = local_parent @previous = previous @payload = payload @started_at = started_at @detached = detached @owner = Fiber.current end |
Instance Attribute Details
#name ⇒ Object (readonly)
Operation identity, inherited attributes, previous local handle, and monotonic start time.
61 62 63 |
# File 'lib/little_ghost/instrumentation.rb', line 61 def name @name end |
#operation_id ⇒ Object (readonly)
Operation identity, inherited attributes, previous local handle, and monotonic start time.
61 62 63 |
# File 'lib/little_ghost/instrumentation.rb', line 61 def operation_id @operation_id end |
#parent_operation_id ⇒ Object (readonly)
Operation identity, inherited attributes, previous local handle, and monotonic start time.
61 62 63 |
# File 'lib/little_ghost/instrumentation.rb', line 61 def parent_operation_id @parent_operation_id end |
#payload ⇒ Object (readonly)
Operation identity, inherited attributes, previous local handle, and monotonic start time.
61 62 63 |
# File 'lib/little_ghost/instrumentation.rb', line 61 def payload @payload end |
#previous ⇒ Object (readonly)
Operation identity, inherited attributes, previous local handle, and monotonic start time.
61 62 63 |
# File 'lib/little_ghost/instrumentation.rb', line 61 def previous @previous end |
#started_at ⇒ Object (readonly)
Operation identity, inherited attributes, previous local handle, and monotonic start time.
61 62 63 |
# File 'lib/little_ghost/instrumentation.rb', line 61 def started_at @started_at end |
Instance Method Details
#active? ⇒ Boolean
Indicates whether this handle is still active.
88 |
# File 'lib/little_ghost/instrumentation.rb', line 88 def active? = @bus.active?(self) |
#detached? ⇒ Boolean
Indicates whether this handle is outside the fiber-local operation stack.
84 85 |
# File 'lib/little_ghost/instrumentation.rb', line 84 def detached? = @detached # Indicates whether the parent is another active handle on this bus. |
#finish(**attributes) ⇒ Object
Completes this operation with additional attributes.
77 78 79 |
# File 'lib/little_ghost/instrumentation.rb', line 77 def finish(**attributes) @bus.finish(self, **attributes) end |
#local_parent? ⇒ Boolean
Indicates whether the parent is another active handle on this bus.
86 87 |
# File 'lib/little_ghost/instrumentation.rb', line 86 def local_parent? = @local_parent # Indicates whether this handle is still active. |
#owner? ⇒ Boolean
Indicates whether this handle belongs to the current fiber.
82 83 |
# File 'lib/little_ghost/instrumentation.rb', line 82 def owner? = @owner.equal?(Fiber.current) # Indicates whether this handle is outside the fiber-local operation stack. |