Class: Langfuse::TraceExportGuard Private

Inherits:
Object
  • Object
show all
Defined in:
lib/langfuse/trace_export_guard.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.

Stops trace export while the live telemetry kill switch is disabled.

Instance Method Summary collapse

Constructor Details

#initialize(delegate:, config:) ⇒ TraceExportGuard

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 TraceExportGuard.

Parameters:



15
16
17
18
# File 'lib/langfuse/trace_export_guard.rb', line 15

def initialize(delegate:, config:)
  @delegate = delegate
  @config = config
end

Instance Method Details

#export(span_data, 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.

Export spans only while trace export is enabled.

Parameters:

  • span_data (Enumerable<OpenTelemetry::SDK::Trace::SpanData>)
  • timeout (Numeric, nil) (defaults to: nil)

Returns:

  • (Integer)

    OpenTelemetry export result code



25
26
27
28
29
# File 'lib/langfuse/trace_export_guard.rb', line 25

def export(span_data, timeout: nil)
  return SUCCESS unless @config.trace_export_enabled?

  @delegate.export(span_data, timeout: timeout)
end

#force_flush(timeout: nil) ⇒ Object

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 delegate result or OpenTelemetry success.

Parameters:

  • timeout (Numeric, nil) (defaults to: nil)

Returns:

  • (Object)

    delegate result or OpenTelemetry success



33
34
35
36
37
# File 'lib/langfuse/trace_export_guard.rb', line 33

def force_flush(timeout: nil)
  return SUCCESS unless @config.trace_export_enabled?

  @delegate.force_flush(timeout: timeout)
end

#shutdown(timeout: nil) ⇒ Object

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.

Release exporter resources after the guarded processor drains its queue.

Parameters:

  • timeout (Numeric, nil) (defaults to: nil)

Returns:

  • (Object)

    delegate shutdown result



43
44
45
# File 'lib/langfuse/trace_export_guard.rb', line 43

def shutdown(timeout: nil)
  @delegate.shutdown(timeout: timeout)
end