Class: Langfuse::MaskingExporter Private

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

Export-stage masking wrapper around the Langfuse OTLP exporter.

Only the copy exported to Langfuse is transformed. Original span data and any other OpenTelemetry exporter remain unchanged.

Instance Method Summary collapse

Constructor Details

#initialize(delegate:, hook:, logger:) ⇒ MaskingExporter

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

Parameters:

  • delegate (#export, #force_flush, #shutdown)

    Langfuse OTLP exporter

  • hook (#call)

    configured mask_otel_spans callable

  • logger (Logger)


27
28
29
30
31
32
# File 'lib/langfuse/masking_exporter.rb', line 27

def initialize(delegate:, hook:, logger:)
  @delegate = delegate
  @hook = hook
  @logger = logger
  @patch_applier = OtelSpanPatchApplier.new(logger: logger)
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.

Mask the batch and delegate export.

Parameters:

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

Returns:

  • (Integer)

    OpenTelemetry export result code



39
40
41
42
43
44
# File 'lib/langfuse/masking_exporter.rb', line 39

def export(span_data, timeout: nil)
  masked_spans = mask_batch(span_data.to_a)
  return SUCCESS if masked_spans.nil? || masked_spans.empty?

  @delegate.export(masked_spans, 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's force_flush result.

Returns:

  • (Object)

    delegate's force_flush result



47
48
49
# File 'lib/langfuse/masking_exporter.rb', line 47

def force_flush(timeout: nil)
  @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.

Returns delegate's shutdown result.

Returns:

  • (Object)

    delegate's shutdown result



52
53
54
# File 'lib/langfuse/masking_exporter.rb', line 52

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