Class: LlmCostTracker::Doctor
- Inherits:
-
Object
- Object
- LlmCostTracker::Doctor
show all
- Defined in:
- lib/llm_cost_tracker/doctor.rb,
lib/llm_cost_tracker/doctor/check.rb,
lib/llm_cost_tracker/doctor/price_check.rb,
lib/llm_cost_tracker/doctor/ingestion_check.rb,
lib/llm_cost_tracker/doctor/capture_verifier.rb
Defined Under Namespace
Classes: CaptureVerifier, Check, IngestionCheck, PriceCheck
Constant Summary
collapse
- COLUMN_GENERATORS =
{
"event_id" => "bin/rails generate llm_cost_tracker:add_ingestion",
"latency_ms" => "bin/rails generate llm_cost_tracker:add_latency_ms",
"stream" => "bin/rails generate llm_cost_tracker:add_streaming",
"usage_source" => "bin/rails generate llm_cost_tracker:add_streaming",
"provider_response_id" => "bin/rails generate llm_cost_tracker:add_provider_response_id"
}.merge(
Generators::AddTokenUsageGenerator::COLUMN_NAMES.to_h do |column|
[column, "bin/rails generate llm_cost_tracker:add_token_usage"]
end
).freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.call ⇒ Object
24
25
26
|
# File 'lib/llm_cost_tracker/doctor.rb', line 24
def call
new.checks
end
|
.healthy?(checks = call) ⇒ Boolean
34
35
36
|
# File 'lib/llm_cost_tracker/doctor.rb', line 34
def healthy?(checks = call)
checks.none? { |check| check.status == :error }
end
|
.report(checks = call) ⇒ Object
28
29
30
31
32
|
# File 'lib/llm_cost_tracker/doctor.rb', line 28
def report(checks = call)
(["LLM Cost Tracker doctor"] + checks.map do |check|
"[#{check.status}] #{check.name}: #{check.message}"
end).join("\n")
end
|
Instance Method Details
#checks ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/llm_cost_tracker/doctor.rb', line 39
def checks
[
configuration_check,
capture_check,
*integration_checks,
active_record_check,
table_check,
column_check,
period_totals_check,
IngestionCheck.new.call,
PriceCheck.new.call,
calls_check
].compact
end
|