observability

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

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 AgentBucket struct {
	AgentID   uint   `json:"agent_id"`
	AgentName string `json:"agent_name"`
	Occupied  int64  `json:"occupied"`
	Capacity  int64  `json:"capacity"`
	Waiters   int64  `json:"waiters"`
}

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 BreakerBoardResponse added in v0.0.11

type BreakerBoardResponse struct {
	Channels     []ChannelBreakerRow `json:"channels"`
	FailedAgents []FailedAgent       `json:"failed_agents"`
}

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 FailedAgent

type FailedAgent struct {
	AgentID   uint   `json:"agent_id"`
	AgentName string `json:"agent_name"`
	Error     string `json:"error"`
}

type Handler

type Handler struct {
	HubCall           func(agentID string, method string, params any, timeout time.Duration) (json.RawMessage, error)
	GetOnlineAgentIDs func() []string
}

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) GetLimiterUsage

func (h *Handler) GetLimiterUsage(c *app.Context, _ api.EmptyRequest) (LimiterUsageResponse, error)

func (*Handler) GetRecentHealth

func (h *Handler) GetRecentHealth(c *app.Context, _ api.EmptyRequest) (RecentHealthResponse, error)

GetRecentHealth 返回各 agent 近窗错误率/QPS。窗口取 health_window_seconds 设置(默认 300)。

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"`
}

type RecentHealthResponse

type RecentHealthResponse struct {
	Agents     []AgentHealthRow `json:"agents"`
	WindowSecs int              `json:"window_secs"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL