persist_stat

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 2 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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