Module: Langfuse::AppRootTracking Private

Defined in:
lib/langfuse/app_root_tracking.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Owns application-root state for active span trees.

Defined Under Namespace

Classes: Tracker

Class Method Summary collapse

Class Method Details

.eligible_without_tracked_parent?(span) ⇒ 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.

Return whether an exported span can be an application root when its parent is untracked.

LiteLLM can emit raw_gen_ai_request after its exported parent finishes. The late child must not become a second application root.

Parameters:

  • span (OpenTelemetry::SDK::Trace::Span)

    Span to inspect

Returns:

  • (Boolean)

    Whether the span can be an application root



21
22
23
24
25
26
# File 'lib/langfuse/app_root_tracking.rb', line 21

def self.eligible_without_tracked_parent?(span)
  return true if span.parent_span_id == OpenTelemetry::Trace::INVALID_SPAN_ID

  identity = [span.instrumentation_scope&.name, span.name]
  !APP_ROOT_INELIGIBLE_SPANS.include?(identity)
end