metrics

package
v1.1.46 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggrMethodType

type AggrMethodType string

聚合方法

const AggrAvg AggrMethodType = "avg" //求平均
const AggrLast AggrMethodType = "last" //取最后
const AggrSum AggrMethodType = "sum" //求和

type IIndicator

type IIndicator interface {
	Report(data IndicData) //上报数据
}

IIndicator 指标器接口

type IOpStatistical

type IOpStatistical interface {
	IStatistical
	RegIndicator(IIndicator) //注册指标器
}

统计器接口

type IStatistical

type IStatistical interface {
	Push(name string, value float64, opts ...StsOpt) IStatistical
}

统计器接口

type IndicAggrMethod added in v1.1.46

type IndicAggrMethod string
const (
	AggrByCount IndicAggrMethod = "count" //求和
	AggrBySum   IndicAggrMethod = "sum"   //求和
	AggrByAvg   IndicAggrMethod = "avg"   //求平均
	AggrByMax   IndicAggrMethod = "max"   //求最大值
	AggrByMin   IndicAggrMethod = "min"   //最小值
)

func (IndicAggrMethod) Aggr added in v1.1.46

func (m IndicAggrMethod) Aggr(old IndicData, cur IndicData) IndicData

type IndicData

type IndicData struct {
	Name       string
	Value      float64
	Unit       string
	AggrMethod IndicAggrMethod   //聚合方式
	AggrScope  time.Duration     //聚合时间范围,最小单位为秒
	Labels     map[string]string //标签
	Time       int64             //指标对应时间,单位:毫秒级时间戳
}

IndicData 单个指标数据

func (IndicData) Append added in v1.1.46

func (ind IndicData) Append(cur IndicData) IndicData

func (IndicData) EntireLabels added in v1.1.46

func (ind IndicData) EntireLabels() map[string]string

type LogIndicator

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

func NewLogIndicator

func NewLogIndicator(l v1log.ILog, tags ...string) *LogIndicator

NewLogIndicator 指标上报器-日志

func (*LogIndicator) Report

func (ind *LogIndicator) Report(data IndicData)

Report 上报数据

type OpStatistical

type OpStatistical struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

统计器

func NewOpStatistical

func NewOpStatistical(label string, interval int64) *OpStatistical

func (*OpStatistical) Start

func (st *OpStatistical) Start()

type StsOpt

type StsOpt func(*dataValues)

统计可选项类型

func StsWithAggr

func StsWithAggr(aggr AggrMethodType) StsOpt

统计使用聚合方法

func StsWithUnit

func StsWithUnit(unit string) StsOpt

统计使用单位

type TickerAggrIndicator added in v1.1.46

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

TickerAggrIndicator 定时聚合上报indicator

func NewTickerAggrIndicator added in v1.1.46

func NewTickerAggrIndicator(indicators ...IIndicator) *TickerAggrIndicator

NewTickerAggrIndicator 指标上报器-日志

func (*TickerAggrIndicator) Report added in v1.1.46

func (ind *TickerAggrIndicator) Report(data IndicData)

Report 上报数据

Jump to

Keyboard shortcuts

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