Class: Langfuse::SpanProcessor Private
- Inherits:
-
OpenTelemetry::SDK::Trace::SpanProcessor
- Object
- OpenTelemetry::SDK::Trace::SpanProcessor
- 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.
Span processor that applies default and propagated trace attributes on new spans.
On span start, this processor first applies configured trace defaults (environment/release), then overlays attributes propagated in OpenTelemetry context (user/session/metadata/tags/version). This ensures consistent trace dimensions while still honoring per-request propagation.
Instance Method Summary collapse
-
#force_flush(timeout: nil) ⇒ Integer
private
Force flush (no-op for this processor).
-
#initialize(config: Langfuse.configuration) ⇒ SpanProcessor
constructor
private
A new instance of SpanProcessor.
-
#on_finish(span) ⇒ void
private
Called when a span ends.
-
#on_start(span, parent_context) ⇒ void
private
Called when a span starts.
-
#shutdown(timeout: nil) ⇒ Integer
private
Shutdown the processor.
Constructor Details
#initialize(config: Langfuse.configuration) ⇒ 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.
16 17 18 19 |
# File 'lib/langfuse/span_processor.rb', line 16 def initialize(config: Langfuse.configuration) @default_trace_attributes = build_default_trace_attributes(config).freeze super() end |
Instance Method Details
#force_flush(timeout: nil) ⇒ Integer
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.
Force flush (no-op for this processor)
56 57 58 59 60 61 |
# File 'lib/langfuse/span_processor.rb', line 56 def force_flush(timeout: nil) # No-op - nothing to flush # Return 0 to match OpenTelemetry SDK expectation (it finds max timeout from processors) _ = timeout # Suppress unused argument warning 0 end |
#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.
Called when a span ends
37 38 39 |
# File 'lib/langfuse/span_processor.rb', line 37 def on_finish(span) # No-op - we don't need to do anything when spans finish 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.
Called when a span starts
26 27 28 29 30 31 |
# File 'lib/langfuse/span_processor.rb', line 26 def on_start(span, parent_context) return unless span.recording? apply_attributes(span, @default_trace_attributes) apply_attributes(span, propagated_attributes(parent_context)) end |
#shutdown(timeout: nil) ⇒ Integer
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.
Shutdown the processor
45 46 47 48 49 50 |
# File 'lib/langfuse/span_processor.rb', line 45 def shutdown(timeout: nil) # No-op - nothing to clean up # Return 0 to match OpenTelemetry SDK expectation (it finds max timeout from processors) _ = timeout # Suppress unused argument warning 0 end |