Class: Langfuse::ResilientMetricsReporter Private

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

Protects trace processing from failures in an application-owned metrics reporter.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reporter, logger:) ⇒ ResilientMetricsReporter

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



16
17
18
19
20
# File 'lib/langfuse/resilient_metrics_reporter.rb', line 16

def initialize(reporter, logger:)
  @reporter = reporter
  @logger = logger
  @warning_emitted = Concurrent::AtomicBoolean.new(false)
end

Class Method Details

.wrap(reporter, logger:) ⇒ 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.



10
11
12
13
14
# File 'lib/langfuse/resilient_metrics_reporter.rb', line 10

def self.wrap(reporter, logger:)
  return if reporter.nil?

  new(reporter, logger: logger)
end

Instance Method Details

#add_to_counter(metric, increment: 1, labels: {}) ⇒ 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.



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

def add_to_counter(metric, increment: 1, labels: {})
  safely(:add_to_counter) do
    @reporter.add_to_counter(metric, increment: increment, labels: labels)
  end
end

#observe_value(metric, value:, labels: {}) ⇒ 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.



34
35
36
37
38
# File 'lib/langfuse/resilient_metrics_reporter.rb', line 34

def observe_value(metric, value:, labels: {})
  safely(:observe_value) do
    @reporter.observe_value(metric, value: value, labels: labels)
  end
end

#record_value(metric, value:, labels: {}) ⇒ 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.



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

def record_value(metric, value:, labels: {})
  safely(:record_value) do
    @reporter.record_value(metric, value: value, labels: labels)
  end
end