Class: LlmCostTracker::Doctor

Inherits:
Object
  • Object
show all
Defined in:
lib/llm_cost_tracker/doctor.rb,
lib/llm_cost_tracker/doctor/check.rb,
lib/llm_cost_tracker/doctor/probe.rb,
lib/llm_cost_tracker/doctor/price_check.rb,
lib/llm_cost_tracker/doctor/schema_check.rb,
lib/llm_cost_tracker/doctor/ingestion_check.rb,
lib/llm_cost_tracker/doctor/capture_verifier.rb,
lib/llm_cost_tracker/doctor/cost_drift_check.rb,
lib/llm_cost_tracker/doctor/legacy_audit_check.rb,
lib/llm_cost_tracker/doctor/legacy_billing_status_check.rb,
lib/llm_cost_tracker/doctor/pricing_snapshot_drift_check.rb

Defined Under Namespace

Modules: Probe Classes: CaptureVerifier, Check, CostDriftCheck, IngestionCheck, LegacyAuditCheck, LegacyBillingStatusCheck, PriceCheck, PricingSnapshotDriftCheck, SchemaCheck

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.callObject



17
18
19
# File 'lib/llm_cost_tracker/doctor.rb', line 17

def call
  new.checks
end

.healthy?(checks = call) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/llm_cost_tracker/doctor.rb', line 27

def healthy?(checks = call)
  checks.none? { |check| check.status == :error }
end

.report(checks = call) ⇒ Object



21
22
23
24
25
# File 'lib/llm_cost_tracker/doctor.rb', line 21

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

#checksObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/llm_cost_tracker/doctor.rb', line 32

def checks
  [
    configuration_check,
    capture_check,
    *integration_checks,
    active_record_check,
    table_check,
    column_check,
    SchemaCheck.new(name: "call line items", schema: Ledger::Schema::CallLineItems,
                    table: "llm_cost_tracker_call_line_items").call,
    SchemaCheck.new(name: "call tags", schema: Ledger::Schema::CallTags,
                    table: "llm_cost_tracker_call_tags").call,
    SchemaCheck.new(name: "provider invoices", schema: Ledger::Schema::ProviderInvoices,
                    table: "llm_cost_tracker_provider_invoices").call,
    CostDriftCheck.new.call,
    PricingSnapshotDriftCheck.new.call,
    LegacyBillingStatusCheck.new.call,
    LegacyAuditCheck.new.call,
    call_rollups_check,
    IngestionCheck.new.call,
    PriceCheck.new.call,
    calls_check
  ].compact
end