package dto import "time" // CreatePollingAlertRuleReq 创建告警规则请求 type CreatePollingAlertRuleReq struct { RuleName string `json:"rule_name" validate:"required,max=100" description:"规则名称"` TaskType string `json:"task_type" validate:"required" description:"任务类型 (polling:realname/polling:carddata/polling:package)"` MetricType string `json:"metric_type" validate:"required" description:"指标类型 (queue_size/success_rate/avg_duration/concurrency)"` Operator string `json:"operator" validate:"omitempty,oneof=> >= < <= ==" description:"比较运算符,默认 >"` Threshold float64 `json:"threshold" validate:"required" description:"阈值"` AlertLevel string `json:"alert_level" validate:"required,oneof=warning critical" description:"告警级别 (warning/critical)"` CooldownMinutes int `json:"cooldown_minutes" validate:"omitempty,min=0,max=1440" description:"冷却时间(分钟),默认5分钟"` NotifyChannels string `json:"notify_channels" validate:"omitempty" description:"通知渠道(JSON格式)"` } // UpdatePollingAlertRuleReq 更新告警规则请求(Body 部分) type UpdatePollingAlertRuleReq struct { RuleName *string `json:"rule_name" validate:"omitempty,max=100" description:"规则名称"` Threshold *float64 `json:"threshold" validate:"omitempty" description:"阈值"` AlertLevel *string `json:"alert_level" validate:"omitempty,oneof=warning critical" description:"告警级别"` Status *int `json:"status" validate:"omitempty,oneof=0 1" description:"状态 (0:禁用, 1:启用)"` CooldownMinutes *int `json:"cooldown_minutes" validate:"omitempty,min=0,max=1440" description:"冷却时间(分钟)"` NotifyChannels *string `json:"notify_channels" validate:"omitempty" description:"通知渠道"` } // UpdatePollingAlertRuleParams 更新告警规则参数(包含路径参数和 Body) type UpdatePollingAlertRuleParams struct { IDReq UpdatePollingAlertRuleReq } // PollingAlertRuleResp 告警规则响应 type PollingAlertRuleResp struct { ID uint `json:"id" description:"规则ID"` RuleName string `json:"rule_name" description:"规则名称"` TaskType string `json:"task_type" description:"任务类型"` TaskTypeName string `json:"task_type_name" description:"任务类型名称"` MetricType string `json:"metric_type" description:"指标类型"` MetricTypeName string `json:"metric_type_name" description:"指标类型名称"` Operator string `json:"operator" description:"比较运算符"` Threshold float64 `json:"threshold" description:"阈值"` AlertLevel string `json:"alert_level" description:"告警级别"` Status int `json:"status" description:"状态 (0:禁用, 1:启用)"` CooldownMinutes int `json:"cooldown_minutes" description:"冷却时间(分钟)"` NotifyChannels string `json:"notify_channels" description:"通知渠道"` CreatedAt time.Time `json:"created_at" description:"创建时间"` UpdatedAt time.Time `json:"updated_at" description:"更新时间"` } // PollingAlertRuleListResp 告警规则列表响应 type PollingAlertRuleListResp struct { Items []*PollingAlertRuleResp `json:"items" description:"告警规则列表"` } // PollingAlertHistoryResp 告警历史响应 type PollingAlertHistoryResp struct { ID uint `json:"id" description:"历史ID"` RuleID uint `json:"rule_id" description:"规则ID"` RuleName string `json:"rule_name" description:"规则名称"` TaskType string `json:"task_type" description:"任务类型"` MetricType string `json:"metric_type" description:"指标类型"` AlertLevel string `json:"alert_level" description:"告警级别"` Threshold float64 `json:"threshold" description:"阈值"` CurrentValue float64 `json:"current_value" description:"触发时的值"` Message string `json:"message" description:"告警消息"` CreatedAt time.Time `json:"created_at" description:"触发时间"` } // PollingAlertHistoryListResp 告警历史列表响应 type PollingAlertHistoryListResp struct { Items []*PollingAlertHistoryResp `json:"items" description:"告警历史列表"` Total int64 `json:"total" description:"总数"` Page int `json:"page" description:"当前页"` PageSize int `json:"page_size" description:"每页数量"` TotalPages int `json:"total_pages" description:"总页数"` } // ListPollingAlertHistoryReq 查询告警历史请求 type ListPollingAlertHistoryReq struct { RuleID *uint `json:"rule_id" query:"rule_id" description:"规则ID"` Page int `json:"page" query:"page" validate:"omitempty,min=1" description:"页码"` PageSize int `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=100" description:"每页数量"` }