Class: Langfuse::SpanProcessor Private
- Inherits:
-
OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor
- Object
- OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor
- Langfuse::SpanProcessor
- Defined in:
- lib/langfuse/span_processor.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.
Batch span processor that owns Langfuse’s enrichment and export filtering.
Instance Method Summary collapse
-
#initialize(config:, exporter:) ⇒ SpanProcessor
constructor
private
A new instance of SpanProcessor.
-
#on_finish(span) ⇒ void
private
Drop spans when the export filter rejects them or raises.
-
#on_start(span, parent_context) ⇒ void
private
Apply Langfuse trace defaults and propagated attributes before a span records work.
Constructor Details
#initialize(config:, exporter:) ⇒ SpanProcessor
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 SpanProcessor.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/langfuse/span_processor.rb', line 12 def initialize(config:, exporter:) @logger = config.logger @default_trace_attributes = build_default_trace_attributes(config).freeze @should_export_span = config.should_export_span || Langfuse.method(:default_export_span?) super( exporter, max_queue_size: config.batch_size * 2, schedule_delay: schedule_delay_for(config), max_export_batch_size: config.batch_size ) end |
Instance Method Details
#on_finish(span) ⇒ 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.
Drop spans when the export filter rejects them or raises.
41 42 43 44 45 |
# File 'lib/langfuse/span_processor.rb', line 41 def on_finish(span) return unless should_export_span?(span) super end |
#on_start(span, parent_context) ⇒ 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.
Apply Langfuse trace defaults and propagated attributes before a span records work.
30 31 32 33 34 35 |
# File 'lib/langfuse/span_processor.rb', line 30 def on_start(span, parent_context) return unless span.recording? apply_attributes(span, @default_trace_attributes) apply_attributes(span, propagated_attributes(parent_context)) end |