metrics

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHandler added in v1.0.3

func GetHandler() http.Handler

GetHandler 返回HTTP处理器用于对接各种框架

Types

type ActiveChannelMetrics

type ActiveChannelMetrics interface {
	ObserveActive(counts, size float64)
}

ActiveChannelMetrics 活跃缓冲区的通道指标

type AsyncGoroutineMetrics

type AsyncGoroutineMetrics interface {
	// ObserveAsyncGoroutine 异步goroutine数量的监控,增加/减少都对应各自的数量
	ObserveAsyncGoroutine(operation chanjet.OperationType, delta float64)
}

AsyncGoroutineMetrics 异步读通道数据的goroutine数量

type BatchCollectImpl

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

BatchCollectImpl 批量指标采集器,封装底层采集器,增加定时任务 定期将指标数据写入到底层采集器

func NewBatchCollector

func NewBatchCollector(mc Collector) *BatchCollectImpl

func (*BatchCollectImpl) Flush

func (b *BatchCollectImpl) Flush()

func (*BatchCollectImpl) ObserveAsyncWorker

func (b *BatchCollectImpl) ObserveAsyncWorker(op chanjet.OperationType)

func (*BatchCollectImpl) RecordPoolAlloc

func (b *BatchCollectImpl) RecordPoolAlloc()

func (*BatchCollectImpl) RecordRead

func (b *BatchCollectImpl) RecordRead(count, size int64, err error)

func (*BatchCollectImpl) RecordSwitch

func (b *BatchCollectImpl) RecordSwitch(status chanjet.SwitchStatus, latencySeconds int64)

func (*BatchCollectImpl) RecordWrite

func (b *BatchCollectImpl) RecordWrite(size int64, err error)

func (*BatchCollectImpl) Start

func (b *BatchCollectImpl) Start()

func (*BatchCollectImpl) Stop

func (b *BatchCollectImpl) Stop()

type BatchCollector

type BatchCollector interface {
	Controller
	Recorder
}

BatchCollector 批量上报指标数据的采集器,抽象出来给到调用方的接口

type ChannelMetrics

type ChannelMetrics interface {
	ChannelSwitchMetrics
	ActiveChannelMetrics
}

ChannelMetrics 通道相关的指标数据

type ChannelSwitchMetrics

type ChannelSwitchMetrics interface {
	SwitchWithLatency(status chanjet.SwitchStatus, counts float64, millSeconds float64)
}

ChannelSwitchMetrics 通道切换的指标数据

type Collector

type Collector interface {
	CollectSwitcher(enable bool) // 采集器开关
	WriteMetrics
	ReadMetrics
	PoolMetrics
	AsyncGoroutineMetrics
	ChannelMetrics
}

Collector 指标监控接口

type Controller

type Controller interface {
	Start() // 启动异步批量更新
	Stop()  // 停止异步批量更新
	Flush() // 强制立即批量更新
}

Controller 批量更新控制器

type PoolMetrics

type PoolMetrics interface {
	// AllocInc 分配的对象计数增加的差值
	AllocInc(delta float64)
}

PoolMetrics 缓存池指标数据

type Prometheus

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

func NewPrometheus

func NewPrometheus() *Prometheus

func (*Prometheus) AllocInc

func (p *Prometheus) AllocInc(delta float64)

func (*Prometheus) CollectSwitcher

func (p *Prometheus) CollectSwitcher(enable bool)

func (*Prometheus) ObserveActive

func (p *Prometheus) ObserveActive(counts, size float64)

func (*Prometheus) ObserveAsyncGoroutine

func (p *Prometheus) ObserveAsyncGoroutine(operation chanjet.OperationType, counts float64)

func (*Prometheus) ObserveRead

func (p *Prometheus) ObserveRead(counts, bytes, errors float64)

func (*Prometheus) ObserveWrite

func (p *Prometheus) ObserveWrite(counts, bytes, errors float64)

func (*Prometheus) SwitchWithLatency

func (p *Prometheus) SwitchWithLatency(status chanjet.SwitchStatus, counts, millSeconds float64)

type Read

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

Read 读数据的指标

func (*Read) Reset

func (r *Read) Reset()

type ReadMetrics

type ReadMetrics interface {
	// ObserveRead 读取的数量、写入的大小、错误数
	ObserveRead(counts, bytes, errors float64)
}

ReadMetrics 读取数据写入readq通道的指标数据

type Recorder

type Recorder interface {
	RecordWrite(size int64, err error)                              // 上报写数据
	RecordRead(count, size int64, err error)                        // 上报读数据
	RecordSwitch(status chanjet.SwitchStatus, latencySeconds int64) // 上报通道切换数据
	ObserveAsyncWorker(op chanjet.OperationType)                    // 上报异步goroutine数据
	RecordPoolAlloc()                                               // 上报池对象创建数据
}

Recorder 提供给调用方的接口

type Supporting

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

func (*Supporting) Reset

func (s *Supporting) Reset()

type Write

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

Write 写数据的指标

func (*Write) Reset

func (w *Write) Reset()

type WriteMetrics

type WriteMetrics interface {
	// ObserveWrite 写入的数量、写入的大小、错误数
	ObserveWrite(counts, bytes, errors float64)
}

WriteMetrics 写操作指标

Jump to

Keyboard shortcuts

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