feat: billing layer v1.3.86 — PostgreSQL statistics

- internal/billing: Store interface + pgStore (pgx/v5 pool) + NoopStore
- factory.go: NewStore() from BILLING_DSN env var (NoopStore fallback)
- Server.billing: injected into Config, initialized in main
- handleInvokeFunction: record invocation (TriggerConsole)
- invokeInternalFunction: record invocation (TriggerHTTP)
- handleCreateFunction: record event_type=create
- handleCloneFunction: record event_type=clone
- handleDeleteFunction: record event_type=delete
- table: invocations (namespace, function_name, trigger_type, duration_ms, status_code...)
- BILLING_DSN added to console.yaml
- pgx/v5 added to go.mod/go.sum
This commit is contained in:
“Naeel”
2026-05-10 08:26:42 +04:00
parent 11c90bac9e
commit aaa1b9a82d
15 changed files with 327 additions and 6 deletions
+4
View File
@@ -12,6 +12,7 @@ import (
"fission-console/internal/api"
"fission-console/internal/auth"
"fission-console/internal/billing"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
@@ -48,6 +49,8 @@ func main() {
Demo: &auth.DemoAuthenticator{},
}
billingStore := billing.NewStore()
srv := api.NewServer(api.Config{
Dyn: dyn,
Kube: kube,
@@ -64,6 +67,7 @@ func main() {
LLMUrl: envDefault("FISSION_LLM_URL", "https://api.aillm.ru"),
LLMKey: os.Getenv("FISSION_LLM_KEY"),
// --- end ai/ask feature ---
Billing: billingStore,
})
// Запускаем фоновые горутины: reaper истёкших функций