Class: Langfuse::AppRootTracking::Tracker Private
- Inherits:
-
Object
- Object
- Langfuse::AppRootTracking::Tracker
- Defined in:
- lib/langfuse/app_root_tracking.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defers a finished span until its active ancestors have final export decisions.
Instance Method Summary collapse
-
#empty? ⇒ Boolean
private
Whether the tracker has no active span trees.
-
#finish(span, exportable:) ⇒ Array<ReadySpan>
private
Resolve finished spans whose ancestor export decisions are final.
-
#initialize ⇒ Tracker
constructor
private
A new instance of Tracker.
- #remember(span, trace_claimed:, untracked_parent_root_eligible:) ⇒ void private
Constructor Details
#initialize ⇒ Tracker
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Tracker.
48 49 50 51 |
# File 'lib/langfuse/app_root_tracking.rb', line 48 def initialize @mutex = Mutex.new @state_by_span_id = {} end |
Instance Method Details
#empty? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Whether the tracker has no active span trees.
88 89 90 |
# File 'lib/langfuse/app_root_tracking.rb', line 88 def empty? @mutex.synchronize { @state_by_span_id.empty? } end |
#finish(span, exportable:) ⇒ Array<ReadySpan>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Resolve finished spans whose ancestor export decisions are final.
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/langfuse/app_root_tracking.rb', line 74 def finish(span, exportable:) @mutex.synchronize do state = @state_by_span_id[span.context.span_id] return [] unless state state.finished = true state.exportable = exportable ready_spans = resolve_ready_spans release_finished_states ready_spans end end |
#remember(span, trace_claimed:, untracked_parent_root_eligible:) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/langfuse/app_root_tracking.rb', line 57 def remember(span, trace_claimed:, untracked_parent_root_eligible:) @mutex.synchronize do parent_state = @state_by_span_id[span.parent_span_id] parent_state.active_child_count += 1 if parent_state @state_by_span_id[span.context.span_id] = build_state( span, trace_claimed: trace_claimed, untracked_parent_root_eligible: untracked_parent_root_eligible ) end end |