Documentation
¶
Index ¶
- type MetricsRecorder
- func (m *MetricsRecorder) LogDebug(msg string, fields ...zap.Field)
- func (m *MetricsRecorder) LogError(msg string, err error, fields ...zap.Field)
- func (m *MetricsRecorder) LogInfo(msg string, fields ...zap.Field)
- func (m *MetricsRecorder) LogWarn(msg string, fields ...zap.Field)
- func (m *MetricsRecorder) RecordBufferAverageSize(ctx context.Context, avgSize float64)
- func (m *MetricsRecorder) RecordBufferDiscard(ctx context.Context, bufferSize int)
- func (m *MetricsRecorder) RecordBufferPoolSize(ctx context.Context, size int64)
- func (m *MetricsRecorder) RecordConnectionPoolSize(ctx context.Context, size int64)
- func (m *MetricsRecorder) RecordErrorRate(ctx context.Context, topic string, rate float64)
- func (m *MetricsRecorder) RecordMessageFailed(ctx context.Context, topic string, err error)
- func (m *MetricsRecorder) RecordMessageLatency(ctx context.Context, topic string, latency time.Duration)
- func (m *MetricsRecorder) RecordMessageReceived(ctx context.Context, topic string)
- func (m *MetricsRecorder) RecordMessageSent(ctx context.Context, topic string)
- func (m *MetricsRecorder) RecordObjectCreate(ctx context.Context, poolType string)
- func (m *MetricsRecorder) RecordObjectGet(ctx context.Context, poolType string)
- func (m *MetricsRecorder) RecordObjectPut(ctx context.Context, poolType string)
- func (m *MetricsRecorder) RecordObjectUsage(ctx context.Context, poolType string, duration time.Duration)
- func (m *MetricsRecorder) RecordPoolHitRate(ctx context.Context, poolType string, hitRate float64)
- func (m *MetricsRecorder) RecordPoolObjectCount(ctx context.Context, poolType string, count int64)
- func (m *MetricsRecorder) RecordPoolStatistics(ctx context.Context, poolType string, stats PoolStatistics)
- func (m *MetricsRecorder) RecordProcessingError(ctx context.Context, topic string, errorType string)
- func (m *MetricsRecorder) RecordProcessingTime(ctx context.Context, topic string, duration time.Duration)
- func (m *MetricsRecorder) RecordQueueBacklog(ctx context.Context, topic string, backlog int64)
- func (m *MetricsRecorder) RecordQueueSize(ctx context.Context, topic string, size int64)
- func (m *MetricsRecorder) RecordRetryAttempt(ctx context.Context, topic string, attempt int)
- func (m *MetricsRecorder) RecordThroughput(ctx context.Context, topic string, count float64)
- type Observer
- type PoolStatistics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetricsRecorder ¶
type MetricsRecorder struct {
// contains filtered or unexported fields
}
MetricsRecorder 指标记录器
func NewMetricsRecorder ¶
func NewMetricsRecorder(observer Observer, adapter string) (*MetricsRecorder, error)
NewMetricsRecorder 创建指标记录器
func (*MetricsRecorder) LogDebug ¶
func (m *MetricsRecorder) LogDebug(msg string, fields ...zap.Field)
LogDebug 记录调试日志
func (*MetricsRecorder) LogError ¶
func (m *MetricsRecorder) LogError(msg string, err error, fields ...zap.Field)
LogError 记录错误日志
func (*MetricsRecorder) LogInfo ¶
func (m *MetricsRecorder) LogInfo(msg string, fields ...zap.Field)
LogInfo 记录信息日志
func (*MetricsRecorder) LogWarn ¶
func (m *MetricsRecorder) LogWarn(msg string, fields ...zap.Field)
LogWarn 记录警告日志
func (*MetricsRecorder) RecordBufferAverageSize ¶ added in v0.3.1
func (m *MetricsRecorder) RecordBufferAverageSize(ctx context.Context, avgSize float64)
RecordBufferAverageSize 记录缓冲区平均大小
func (*MetricsRecorder) RecordBufferDiscard ¶ added in v0.3.1
func (m *MetricsRecorder) RecordBufferDiscard(ctx context.Context, bufferSize int)
RecordBufferDiscard 记录缓冲区丢弃事件
func (*MetricsRecorder) RecordBufferPoolSize ¶ added in v0.3.1
func (m *MetricsRecorder) RecordBufferPoolSize(ctx context.Context, size int64)
RecordBufferPoolSize 记录缓冲池大小
func (*MetricsRecorder) RecordConnectionPoolSize ¶
func (m *MetricsRecorder) RecordConnectionPoolSize(ctx context.Context, size int64)
RecordConnectionPoolSize 记录连接池大小
func (*MetricsRecorder) RecordErrorRate ¶
func (m *MetricsRecorder) RecordErrorRate(ctx context.Context, topic string, rate float64)
RecordErrorRate 记录错误率
func (*MetricsRecorder) RecordMessageFailed ¶
func (m *MetricsRecorder) RecordMessageFailed(ctx context.Context, topic string, err error)
RecordMessageFailed 记录消息失败
func (*MetricsRecorder) RecordMessageLatency ¶
func (m *MetricsRecorder) RecordMessageLatency(ctx context.Context, topic string, latency time.Duration)
RecordMessageLatency 记录消息延迟
func (*MetricsRecorder) RecordMessageReceived ¶
func (m *MetricsRecorder) RecordMessageReceived(ctx context.Context, topic string)
RecordMessageReceived 记录消息接收
func (*MetricsRecorder) RecordMessageSent ¶
func (m *MetricsRecorder) RecordMessageSent(ctx context.Context, topic string)
RecordMessageSent 记录消息发送
func (*MetricsRecorder) RecordObjectCreate ¶ added in v0.3.1
func (m *MetricsRecorder) RecordObjectCreate(ctx context.Context, poolType string)
RecordObjectCreate 记录新对象创建
func (*MetricsRecorder) RecordObjectGet ¶ added in v0.3.1
func (m *MetricsRecorder) RecordObjectGet(ctx context.Context, poolType string)
RecordObjectGet 记录对象获取操作
func (*MetricsRecorder) RecordObjectPut ¶ added in v0.3.1
func (m *MetricsRecorder) RecordObjectPut(ctx context.Context, poolType string)
RecordObjectPut 记录对象归还操作
func (*MetricsRecorder) RecordObjectUsage ¶ added in v0.3.1
func (m *MetricsRecorder) RecordObjectUsage(ctx context.Context, poolType string, duration time.Duration)
RecordObjectUsage 记录对象使用时长
func (*MetricsRecorder) RecordPoolHitRate ¶ added in v0.3.1
func (m *MetricsRecorder) RecordPoolHitRate(ctx context.Context, poolType string, hitRate float64)
RecordPoolHitRate 记录对象池命中率
func (*MetricsRecorder) RecordPoolObjectCount ¶ added in v0.3.1
func (m *MetricsRecorder) RecordPoolObjectCount(ctx context.Context, poolType string, count int64)
RecordPoolObjectCount 记录对象池中对象数量
func (*MetricsRecorder) RecordPoolStatistics ¶ added in v0.3.1
func (m *MetricsRecorder) RecordPoolStatistics(ctx context.Context, poolType string, stats PoolStatistics)
RecordPoolStatistics 批量记录池统计信息
func (*MetricsRecorder) RecordProcessingError ¶
func (m *MetricsRecorder) RecordProcessingError(ctx context.Context, topic string, errorType string)
RecordProcessingError 记录处理错误
func (*MetricsRecorder) RecordProcessingTime ¶
func (m *MetricsRecorder) RecordProcessingTime(ctx context.Context, topic string, duration time.Duration)
RecordProcessingTime 记录处理时间
func (*MetricsRecorder) RecordQueueBacklog ¶
func (m *MetricsRecorder) RecordQueueBacklog(ctx context.Context, topic string, backlog int64)
RecordQueueBacklog 记录队列积压
func (*MetricsRecorder) RecordQueueSize ¶
func (m *MetricsRecorder) RecordQueueSize(ctx context.Context, topic string, size int64)
RecordQueueSize 记录队列大小
func (*MetricsRecorder) RecordRetryAttempt ¶
func (m *MetricsRecorder) RecordRetryAttempt(ctx context.Context, topic string, attempt int)
RecordRetryAttempt 记录重试尝试
func (*MetricsRecorder) RecordThroughput ¶
func (m *MetricsRecorder) RecordThroughput(ctx context.Context, topic string, count float64)
RecordThroughput 记录吞吐量
type Observer ¶
type Observer interface {
// GetMeter 获取OpenTelemetry Meter实例
GetMeter() metric.Meter
// GetLogger 获取zap Logger实例
GetLogger() *zap.Logger
}
Observer 可观测性接口,由外部调用方实现并注入
type PoolStatistics ¶ added in v0.3.1
type PoolStatistics struct {
HitRate float64 // 命中率
ObjectCount int64 // 对象数量
AverageBufferSize float64 // 平均缓冲区大小
}
PoolStatistics 池统计信息结构体