feat(数据库): 添加运维监控数据模型和数据库迁移脚本
- 新增 ops 监控数据库迁移脚本(表结构定义) - 定义核心数据模型(ops_models.go) - 定义告警相关模型(ops_alert_models.go) - 定义仪表板数据模型(ops_dashboard_models.go) - 定义实时监控数据模型(ops_realtime_models.go) - 定义配置相关模型(ops_settings_models.go) - 定义趋势分析数据模型(ops_trend_models.go)
This commit is contained in:
65
backend/internal/service/ops_trend_models.go
Normal file
65
backend/internal/service/ops_trend_models.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package service
|
||||
|
||||
import "time"
|
||||
|
||||
type OpsThroughputTrendPoint struct {
|
||||
BucketStart time.Time `json:"bucket_start"`
|
||||
RequestCount int64 `json:"request_count"`
|
||||
TokenConsumed int64 `json:"token_consumed"`
|
||||
QPS float64 `json:"qps"`
|
||||
TPS float64 `json:"tps"`
|
||||
}
|
||||
|
||||
type OpsThroughputPlatformBreakdownItem struct {
|
||||
Platform string `json:"platform"`
|
||||
RequestCount int64 `json:"request_count"`
|
||||
TokenConsumed int64 `json:"token_consumed"`
|
||||
}
|
||||
|
||||
type OpsThroughputGroupBreakdownItem struct {
|
||||
GroupID int64 `json:"group_id"`
|
||||
GroupName string `json:"group_name"`
|
||||
RequestCount int64 `json:"request_count"`
|
||||
TokenConsumed int64 `json:"token_consumed"`
|
||||
}
|
||||
|
||||
type OpsThroughputTrendResponse struct {
|
||||
Bucket string `json:"bucket"`
|
||||
|
||||
Points []*OpsThroughputTrendPoint `json:"points"`
|
||||
|
||||
// Optional drilldown helpers:
|
||||
// - When no platform/group is selected: returns totals by platform.
|
||||
// - When platform is selected but group is not: returns top groups in that platform.
|
||||
ByPlatform []*OpsThroughputPlatformBreakdownItem `json:"by_platform,omitempty"`
|
||||
TopGroups []*OpsThroughputGroupBreakdownItem `json:"top_groups,omitempty"`
|
||||
}
|
||||
|
||||
type OpsErrorTrendPoint struct {
|
||||
BucketStart time.Time `json:"bucket_start"`
|
||||
|
||||
ErrorCountTotal int64 `json:"error_count_total"`
|
||||
BusinessLimitedCount int64 `json:"business_limited_count"`
|
||||
ErrorCountSLA int64 `json:"error_count_sla"`
|
||||
|
||||
UpstreamErrorCountExcl429529 int64 `json:"upstream_error_count_excl_429_529"`
|
||||
Upstream429Count int64 `json:"upstream_429_count"`
|
||||
Upstream529Count int64 `json:"upstream_529_count"`
|
||||
}
|
||||
|
||||
type OpsErrorTrendResponse struct {
|
||||
Bucket string `json:"bucket"`
|
||||
Points []*OpsErrorTrendPoint `json:"points"`
|
||||
}
|
||||
|
||||
type OpsErrorDistributionItem struct {
|
||||
StatusCode int `json:"status_code"`
|
||||
Total int64 `json:"total"`
|
||||
SLA int64 `json:"sla"`
|
||||
BusinessLimited int64 `json:"business_limited"`
|
||||
}
|
||||
|
||||
type OpsErrorDistributionResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
Items []*OpsErrorDistributionItem `json:"items"`
|
||||
}
|
||||
Reference in New Issue
Block a user