towerops/priv
Graham McIntire 01d64a446e refactor(llm): split token tracking into a dedicated llm_usage table
Token-usage doesn't belong on the per-insight row — every consumer of
Towerops.LLM (insight enrichment today; billing-anomaly summaries,
monitoring narratives, fleet weekly reports tomorrow) needs to record
into one queryable place. Per-insight columns also made it impossible
to track LLM calls that aren't tied to an insight.

Schema: `llm_usage` keyed (organization_id, day, model, purpose) with a
unique index. organization_id is nullable for system-level analyses.
Each row carries running totals plus a request_count — callers UPSERT
and increment atomically.

API: `Towerops.LLM.Usage.record/1` for write, `summarize/2` for
read-side rollups. The worker now calls `Usage.record(%{... purpose:
"insight_enrichment"})` after each successful enrichment.

Removed: `llm_prompt_tokens` / `llm_completion_tokens` from
preseem_insights — same migration drops the columns and creates
llm_usage in one go. `apply_llm_enrichment` reverts to /3 (no usage
arg).
2026-05-10 13:13:52 -05:00
..
antennas feat: 198 real vendor .msi antenna patterns + Leaflet auto-load 2026-05-06 15:09:29 -05:00
gettext fix: nav overflow on small screens and fix bad gettext translations 2026-03-11 14:00:31 -05:00
mibs mib update from librenms 2026-01-28 13:38:31 -06:00
profiles fix(snmp): auto-rescale implausible temperature readings 2026-05-10 12:21:24 -05:00
proto chore: migrate agent repo references from GitHub to Codeberg 2026-05-07 07:44:48 -05:00
repo refactor(llm): split token tracking into a dedicated llm_usage table 2026-05-10 13:13:52 -05:00
static feat(insights): OpticalRxLow rule for fiber transceivers 2026-05-09 17:56:38 -05:00