persist_stat

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccumType

type AccumType int
const (
	SUM AccumType = iota
	AVG
)

type MemMetrics

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

func NewMemMetrics

func NewMemMetrics() *MemMetrics

func (*MemMetrics) EmitMetric

func (m *MemMetrics) EmitMetric(tag string, value int64)

func (*MemMetrics) GetMetrics

func (m *MemMetrics) GetMetrics() map[string]int64

type PersistStoreStat

type PersistStoreStat interface {

	// 对于etcd后端,interval >= 60s,以控制数据量 1day <= 60 * 24 (1440)
	SetPolicy(policy Policy) error

	Emit(tag string, value int64) error

	Last5Min() (map[string]int64, error)

	Last20Min() (map[string]int64, error)

	Last1Hour() (map[string]int64, error)

	Last6Hour() (map[string]int64, error)

	Last1Day() (map[string]int64, error)

	Stat(beginTimestamp, endTimestamp time.Time) (map[string]int64, error)

	Clear(beforeTimeStamp time.Time) error

	// Metrics 返回自启动以来的 metric 统计
	Metrics() map[string]int64
}

type Policy

type Policy struct {
	AccumTp      AccumType
	Interval     int // second
	PreserveDays int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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