mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
Enable full resource management via API and support data plane synchronization. - Add CRUD handlers for Providers, Models, and Keys using DTOs - Implement LogWriter service for asynchronous, batched audit logging - Update SyncService to snapshot full configuration state to Redis - Register new API routes and initialize background services - Add configuration options for logging performance tuning
23 lines
831 B
Go
23 lines
831 B
Go
package model
|
|
|
|
import "gorm.io/gorm"
|
|
|
|
// LogRecord stores lightweight metadata for auditing. Avoids full payload unless audit is triggered.
|
|
type LogRecord struct {
|
|
gorm.Model
|
|
Group string `json:"group"`
|
|
KeyID uint `json:"key_id"`
|
|
ModelName string `json:"model"`
|
|
StatusCode int `json:"status_code"`
|
|
LatencyMs int64 `json:"latency_ms"`
|
|
TokensIn int64 `json:"tokens_in"`
|
|
TokensOut int64 `json:"tokens_out"`
|
|
ErrorMessage string `json:"error_message"`
|
|
ClientIP string `json:"client_ip"`
|
|
RequestSize int64 `json:"request_size"`
|
|
ResponseSize int64 `json:"response_size"`
|
|
AuditReason string `json:"audit_reason"`
|
|
RequestBody string `json:"request_body"` // optional, only when audit triggered
|
|
ResponseBody string `json:"response_body"` // optional, only when audit triggered
|
|
}
|