metrics

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	// contains filtered or unexported fields
}

Collector 指标收集器

func NewCollector

func NewCollector(namespace string, logger *zap.Logger) *Collector

NewCollector 创建指标收集器

func (*Collector) RecordAgentExecution

func (c *Collector) RecordAgentExecution(agentType, status string, duration time.Duration)

RecordAgentExecution 记录 Agent 执行 K3 FIX: 移除 agentID 参数,仅使用 agentType(有限枚举值)

func (*Collector) RecordAgentInfo

func (c *Collector) RecordAgentInfo(agentID, agentType string)

RecordAgentInfo 记录 agent_id 到 agent_type 的映射关系(低频调用,仅用于调试)

func (*Collector) RecordAgentStateTransition

func (c *Collector) RecordAgentStateTransition(agentType, fromState, toState string)

RecordAgentStateTransition 记录 Agent 状态转换 K3 FIX: 使用 agentType 替代 agentID,避免 agent_id x from_state x to_state 笛卡尔积爆炸

func (*Collector) RecordCacheEviction

func (c *Collector) RecordCacheEviction(cacheType string)

RecordCacheEviction 记录缓存驱逐

func (*Collector) RecordCacheHit

func (c *Collector) RecordCacheHit(cacheType string)

RecordCacheHit 记录缓存命中

func (*Collector) RecordCacheMiss

func (c *Collector) RecordCacheMiss(cacheType string)

RecordCacheMiss 记录缓存未命中

func (*Collector) RecordCacheSize

func (c *Collector) RecordCacheSize(cacheType string, size int)

RecordCacheSize 记录缓存当前大小

func (*Collector) RecordDBConnections

func (c *Collector) RecordDBConnections(database string, open, idle int)

RecordDBConnections 记录数据库连接数

func (*Collector) RecordDBQuery

func (c *Collector) RecordDBQuery(database, operation string, duration time.Duration)

RecordDBQuery 记录数据库查询

func (*Collector) RecordHTTPRequest

func (c *Collector) RecordHTTPRequest(method, path string, status int, duration time.Duration, requestSize, responseSize int64)

RecordHTTPRequest 记录 HTTP 请求

func (*Collector) RecordLLMRequest

func (c *Collector) RecordLLMRequest(provider, model, status string, duration time.Duration, promptTokens, completionTokens int, cost float64)

RecordLLMRequest 记录 LLM 请求

Jump to

Keyboard shortcuts

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