Documentation
¶
Index ¶
- type AgentBreakerCell
- type AgentBucket
- type AgentHealthRow
- type AgentQueueRow
- type BreakerBoardResponse
- type ChannelBreakerRow
- type DeliveryBoardResponse
- type DeliveryOpRequest
- type DeliveryOpResponse
- type DeliveryQueueItem
- type FailedAgent
- type Handler
- func (h *Handler) GetBreakerBoard(c *app.Context, _ api.EmptyRequest) (BreakerBoardResponse, error)
- func (h *Handler) GetDeliveryBoard(c *app.Context, _ api.EmptyRequest) (DeliveryBoardResponse, error)
- func (h *Handler) GetLimiterUsage(c *app.Context, _ api.EmptyRequest) (LimiterUsageResponse, error)
- func (h *Handler) GetRecentHealth(c *app.Context, _ api.EmptyRequest) (RecentHealthResponse, error)
- func (h *Handler) PostDeliveryOp(c *app.Context, req DeliveryOpRequest) (DeliveryOpResponse, error)
- type LimiterBucketRow
- type LimiterUsageResponse
- type RecentHealthResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentBreakerCell ¶ added in v0.0.11
type AgentBreakerCell struct {
AgentID uint `json:"agent_id"`
AgentName string `json:"agent_name"`
State string `json:"state"`
RemainingMs int64 `json:"remaining_ms"`
Failures int `json:"failures"`
Successes int `json:"successes"`
FailureRate float64 `json:"failure_rate"`
}
AgentBreakerCell 是某渠道在某个 agent 上的熔断器状态(渠道行展开后每 agent 一格)。
type AgentBucket ¶
type AgentHealthRow ¶
type AgentHealthRow struct {
AgentID string `json:"agent_id"`
Requests int64 `json:"requests"`
Failed int64 `json:"failed"`
ErrorRate float64 `json:"error_rate"`
QPS float64 `json:"qps"`
WindowSecs int `json:"window_secs"`
}
AgentHealthRow 是某 agent 近窗健康原始信号(红黄绿由前端按 Settings 阈值算)。
type AgentQueueRow ¶ added in v0.0.13
type AgentQueueRow struct {
AgentID uint `json:"agent_id"`
AgentName string `json:"agent_name"`
StoreLen int `json:"store_len"`
RetryLen int `json:"retry_len"`
TotalBytes int `json:"total_bytes"` // store_bytes+retry_bytes
OldestTs int64 `json:"oldest_ts"`
LastSuccessAt int64 `json:"last_success_at"`
LastError string `json:"last_error"`
Inflight int `json:"inflight"`
APITraceSlimmed uint64 `json:"api_trace_slimmed"`
Items []DeliveryQueueItem `json:"items"`
}
AgentQueueRow 是看板一行:单个 agent 的 usage 投递两级队列快照。
type BreakerBoardResponse ¶ added in v0.0.11
type BreakerBoardResponse struct {
Channels []ChannelBreakerRow `json:"channels"`
FailedAgents []FailedAgent `json:"failed_agents"`
SuccessfulAgentIDs []uint `json:"successful_agent_ids"`
}
type ChannelBreakerRow ¶ added in v0.0.11
type ChannelBreakerRow struct {
Source string `json:"source"`
ChannelID uint `json:"channel_id"`
WorstState string `json:"worst_state"` // Open>HalfOpen>Closed 取最坏
OpenAgents int `json:"open_agents"` // state ∈ {open, half-open} 的 agent 数
TotalAgents int `json:"total_agents"` // 有该 breaker 的 agent 数
Agents []AgentBreakerCell `json:"agents"`
}
ChannelBreakerRow 是看板一行:一个渠道跨所有 agent 的聚合 + 各 agent 明细。
type DeliveryBoardResponse ¶ added in v0.0.13
type DeliveryBoardResponse struct {
Agents []AgentQueueRow `json:"agents"`
FailedAgents []FailedAgent `json:"failed_agents"`
SuccessfulAgentIDs []uint `json:"successful_agent_ids"`
LogBacklog monitoring.LogBacklog `json:"log_backlog"`
}
type DeliveryOpRequest ¶ added in v0.0.13
type DeliveryOpResponse ¶ added in v0.0.13
type DeliveryOpResponse struct {
Affected int `json:"affected"`
}
type DeliveryQueueItem ¶ added in v0.0.13
type DeliveryQueueItem struct {
RequestID string `json:"request_id"`
QueueID string `json:"queue_id,omitempty"`
UsageType string `json:"usage_type,omitempty"`
Bytes int `json:"bytes"`
Attempts int `json:"attempts"`
DegradeLevel int `json:"degrade_level"`
NextAt int64 `json:"next_at"`
}
DeliveryQueueItem 与 agent 侧 reporter.QueueItemSnapshot(旁路重试队列单条记录)同构。
type FailedAgent ¶
type Handler ¶
type Handler struct {
HubCallContext func(context.Context, string, string, any, time.Duration) (json.RawMessage, error)
HubCall func(agentID string, method string, params any, timeout time.Duration) (json.RawMessage, error)
GetOnlineAgentIDs func() []string
LogBacklogSnapshot func() monitoring.LogBacklog
}
Handler 持有扇出可观测 RPC 所需的 Hub 依赖(与 master/api/agent.Handler 同源装配)。
func (*Handler) GetBreakerBoard ¶ added in v0.0.11
func (h *Handler) GetBreakerBoard(c *app.Context, _ api.EmptyRequest) (BreakerBoardResponse, error)
GetBreakerBoard 扇出 agent.breakers 到所有在线 agent,按 (source, channel_id) 聚合成 渠道行(含各 agent 明细 + 最坏状态 + 异常 agent 数),并确定性排序。
func (*Handler) GetDeliveryBoard ¶ added in v0.0.13
func (h *Handler) GetDeliveryBoard(c *app.Context, _ api.EmptyRequest) (DeliveryBoardResponse, error)
GetDeliveryBoard 扇出 agent.usageQueue 到所有在线 agent,汇总成每 agent 一行的投递 看板(镜像 GetBreakerBoard 的扇出/隔离/排序骨架)。
func (*Handler) GetLimiterUsage ¶
func (h *Handler) GetLimiterUsage(c *app.Context, _ api.EmptyRequest) (LimiterUsageResponse, error)
GetLimiterUsage 在聚合预算内读取节点限流占用,并合并成功结果与失败节点。
func (*Handler) GetRecentHealth ¶
func (h *Handler) GetRecentHealth(c *app.Context, _ api.EmptyRequest) (RecentHealthResponse, error)
GetRecentHealth 返回各 agent 近窗错误率/QPS。窗口取 health_window_seconds 设置(默认 300)。
func (*Handler) PostDeliveryOp ¶ added in v0.0.13
func (h *Handler) PostDeliveryOp(c *app.Context, req DeliveryOpRequest) (DeliveryOpResponse, error)
PostDeliveryOp 转发一次管理端旁路队列操作(retry_now/degrade/drop)给目标 agent。 校验全部在转发前完成——非法输入不产生 RPC。
type LimiterBucketRow ¶
type LimiterBucketRow struct {
protocol.LimiterBucketStat
PerAgent []AgentBucket `json:"per_agent"`
}
LimiterBucketRow 是集群聚合后的一行 + per-agent 明细(饱和度看每节点,v1 本地执行=本地求和)。
type LimiterUsageResponse ¶
type LimiterUsageResponse struct {
Buckets []LimiterBucketRow `json:"buckets"`
FailedAgents []FailedAgent `json:"failed_agents"`
SuccessfulAgentIDs []uint `json:"successful_agent_ids"`
}
type RecentHealthResponse ¶
type RecentHealthResponse struct {
Agents []AgentHealthRow `json:"agents"`
WindowSecs int `json:"window_secs"`
}