feat(usage): add event analytics dashboard

This commit is contained in:
Goon committed 2026-06-12 17:51:12 +07:00
1 parent b4c63e4afb
commit 4002bb4c13
31 files changed
+2316 -24

No files matched your search

+1 -1
View File
@@ -135,7 +135,7 @@ func (d *gatewayDeps) wireHTTPHandlersOnServer(
// Usage analytics API
if d.pgStores.Snapshots != nil {
d.server.SetUsageHandler(httpapi.NewUsageHandler(d.pgStores.Snapshots, d.pgStores.DB))
d.server.SetUsageHandler(httpapi.NewUsageHandler(d.pgStores.Snapshots, d.pgStores.UsageEvents, d.pgStores.DB))
}
if d.pgStores.UsageCaps != nil {
d.server.SetUsageCapsHandler(httpapi.NewUsageCapsHandler(d.pgStores.UsageCaps, d.pgStores.Tenants))
+1
View File
@@ -246,6 +246,7 @@ func wireExtras(
ModelPricing: appCfg.Telemetry.ModelPricing,
TracingStore: stores.Tracing,
UsageCaps: usageCapSvc,
UsageEvents: stores.UsageEvents,
MemoryStore: stores.Memory,
ContactStore: stores.Contacts,
TenantStore: stores.Tenants,
+1 -1
View File
@@ -322,7 +322,7 @@ func wireTracingAndCron(
// Start snapshot worker for hourly usage aggregation
var snapshotWorker *tracing.SnapshotWorker
if stores.Snapshots != nil {
snapshotWorker = tracing.NewSnapshotWorker(stores.DB, stores.Snapshots)
snapshotWorker = tracing.NewSnapshotWorker(stores.DB, stores.Snapshots, stores.UsageEvents)
snapshotWorker.Start()
// Backfill historical data in background