metrics

package
v1.1.45 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 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 map[string]*IndicData) //上报数据
}

IIndicator 指标器接口

type IOpStatistical

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

统计器接口

type IStatistical

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

统计器接口

type IndicData

type IndicData struct {
	Name  string
	Value float64
	Unit  string
}

IndicData 单个指标数据

type LogIndicator

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

func NewLogIndicator

func NewLogIndicator(label string) *LogIndicator

指标上报器-日志

func (*LogIndicator) Report

func (l *LogIndicator) Report(data map[string]*IndicData)

上报数据

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 PrometheusIndicator

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

todo 指标上报至prometheus

func NewPrometheusIndicator

func NewPrometheusIndicator(label string) *PrometheusIndicator

func (*PrometheusIndicator) Report

func (l *PrometheusIndicator) Report(data map[string]*IndicData)

上报数据

type StsOpt

type StsOpt func(*dataValues)

统计可选项类型

func StsWithAggr

func StsWithAggr(aggr AggrMethodType) StsOpt

统计使用聚合方法

func StsWithUnit

func StsWithUnit(unit string) StsOpt

统计使用单位

Jump to

Keyboard shortcuts

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