Module: LlmCostTracker::Ingestion
- Defined in:
- lib/llm_cost_tracker/ingestion.rb,
lib/llm_cost_tracker/ingestion/batch.rb,
lib/llm_cost_tracker/ingestion/inbox.rb,
lib/llm_cost_tracker/ingestion/worker.rb,
lib/llm_cost_tracker/ingestion/lease_claim.rb,
app/models/llm_cost_tracker/ingestion/lease.rb,
app/models/llm_cost_tracker/ingestion/inbox_entry.rb
Defined Under Namespace
Classes: Batch, Inbox, InboxEntry, Lease, LeaseClaim, Worker
Constant Summary
collapse
- VERIFY_TAG =
"llm_cost_tracker_verify"
- WRITE_SCHEMA_GUARDS =
[
["llm_cost_tracker_calls", Ledger::Schema::Calls],
["llm_cost_tracker_call_line_items", Ledger::Schema::CallLineItems],
["llm_cost_tracker_call_tags", Ledger::Schema::CallTags],
["llm_cost_tracker_call_rollups", Ledger::Schema::CallRollups]
].freeze
Class Method Summary
collapse
Class Method Details
.ensure_current_schema! ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/llm_cost_tracker/ingestion.rb', line 29
def ensure_current_schema!
unless LlmCostTracker::Call.table_exists?
raise Error, "llm_cost_tracker_calls table is missing; run install generator and migrate"
end
WRITE_SCHEMA_GUARDS.each do |table_name, schema_module|
errors = schema_module.current_schema_errors
next if errors.empty?
raise Error,
"#{table_name} table is not on the current schema: #{errors.join('; ')}; see docs/upgrading.md"
end
end
|
.table_name_prefix ⇒ Object
18
19
20
|
# File 'lib/llm_cost_tracker/ingestion.rb', line 18
def table_name_prefix
"llm_cost_tracker_ingestion_"
end
|
.verify ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/llm_cost_tracker/ingestion.rb', line 43
def verify
unless LlmCostTracker::Call.table_exists?
return [
LlmCostTracker::Doctor::Check.new(
:error,
"active_record",
"llm_cost_tracker_calls table is missing; run install generator and migrate"
)
]
end
[capture_check]
rescue StandardError => e
[LlmCostTracker::Doctor::Check.new(:error, "active_record", "#{e.class}: #{e.message}")]
end
|