mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-14 16:17:25 +00:00
feat(usage): add event analytics dashboard
This commit is contained in:
1 parent
b4c63e4afb
commit
4002bb4c13
31 files changed
+2316
-24
No files matched your search
@@ -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))
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user