Class: RubyLLM::Monitoring::Metrics::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_llm/monitoring/metrics/base.rb

Direct Known Subclasses

Cost, ErrorCount, ResponseTime, Throughput

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope) ⇒ Base

Returns a new instance of Base.



6
7
8
# File 'lib/ruby_llm/monitoring/metrics/base.rb', line 6

def initialize(scope)
  @scope = scope
end

Instance Attribute Details

#scopeObject (readonly)

Returns the value of attribute scope.



4
5
6
# File 'lib/ruby_llm/monitoring/metrics/base.rb', line 4

def scope
  @scope
end

Class Method Details

.title(value = nil) ⇒ Object



41
42
43
# File 'lib/ruby_llm/monitoring/metrics/base.rb', line 41

def title(value = nil)
  value ? @title = value : @title
end

.unit(value = nil) ⇒ Object



45
46
47
# File 'lib/ruby_llm/monitoring/metrics/base.rb', line 45

def unit(value = nil)
  value ? @unit = value : @unit
end

Instance Method Details

#as_chart_dataObject



10
11
12
13
14
15
16
# File 'lib/ruby_llm/monitoring/metrics/base.rb', line 10

def as_chart_data
  {
    title: self.class.title,
    unit: self.class.unit,
    series: build_series(metric_data)
  }.compact
end