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/invoice_reconciliation_check.rb,
lib/llm_cost_tracker/doctor/pricing_snapshot_drift_check.rb

Defined Under Namespace

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.callObject



20
21
22
# File 'lib/llm_cost_tracker/doctor.rb', line 20

def call
  new.checks
end

.healthy?(checks = call) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/llm_cost_tracker/doctor.rb', line 30

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

.report(checks = call) ⇒ Object



24
25
26
27
28
# File 'lib/llm_cost_tracker/doctor.rb', line 24

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



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

def checks
  [
    configuration_check,
    capture_check,
    *LlmCostTracker::Integrations.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,
    *reconciliation_schema_checks,
    CostDriftCheck.new.call,
    PricingSnapshotDriftCheck.new.call,
    *reconciliation_invoice_check,
    LegacyBillingStatusCheck.new.call,
    LegacyAuditCheck.new.call,
    call_rollups_check,
    IngestionCheck.new.call,
    PriceCheck.new.call,
    calls_check
  ].compact
end