mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
feat(model): add request statistics fields to ProviderGroup and APIKey
This commit is contained in:
@@ -18,6 +18,11 @@ type ProviderGroup struct {
|
|||||||
HeadersProfile string `gorm:"size:64" json:"headers_profile,omitempty"`
|
HeadersProfile string `gorm:"size:64" json:"headers_profile,omitempty"`
|
||||||
Models string `json:"models"` // comma-separated list of supported models
|
Models string `json:"models"` // comma-separated list of supported models
|
||||||
Status string `gorm:"size:50;default:'active'" json:"status"`
|
Status string `gorm:"size:50;default:'active'" json:"status"`
|
||||||
|
TotalRequests int64 `gorm:"default:0" json:"total_requests"`
|
||||||
|
SuccessRequests int64 `gorm:"default:0" json:"success_requests"`
|
||||||
|
FailureRequests int64 `gorm:"default:0" json:"failure_requests"`
|
||||||
|
SuccessRate float64 `gorm:"default:0" json:"success_rate"`
|
||||||
|
FailureRate float64 `gorm:"default:0" json:"failure_rate"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// APIKey represents a credential within a provider group.
|
// APIKey represents a credential within a provider group.
|
||||||
@@ -35,4 +40,9 @@ type APIKey struct {
|
|||||||
AutoBan bool `gorm:"default:true" json:"auto_ban"`
|
AutoBan bool `gorm:"default:true" json:"auto_ban"`
|
||||||
BanReason string `gorm:"size:255" json:"ban_reason"`
|
BanReason string `gorm:"size:255" json:"ban_reason"`
|
||||||
BanUntil *time.Time `json:"ban_until"`
|
BanUntil *time.Time `json:"ban_until"`
|
||||||
|
TotalRequests int64 `gorm:"default:0" json:"total_requests"`
|
||||||
|
SuccessRequests int64 `gorm:"default:0" json:"success_requests"`
|
||||||
|
FailureRequests int64 `gorm:"default:0" json:"failure_requests"`
|
||||||
|
SuccessRate float64 `gorm:"default:0" json:"success_rate"`
|
||||||
|
FailureRate float64 `gorm:"default:0" json:"failure_rate"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user