metrics

package
v0.12.0-unstable25 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func API_GetMetrics

func API_GetMetrics(w http.ResponseWriter, req *http.Request)

func API_ResetMetrics

func API_ResetMetrics(w http.ResponseWriter, req *http.Request)

func AggloAndCommitMetrics

func AggloAndCommitMetrics()

func CommitAggl

func CommitAggl(metrics []DataDefDB)

func GetSystemMetrics

func GetSystemMetrics()

func Init

func Init()

func InitAggl

func InitAggl()

func MergeMetric

func MergeMetric(SetOperation string, currentValue int, newValue int, avgIndex int) int

func ModuloTime

func ModuloTime(start time.Time, modulo time.Duration) time.Time

func PushSetMetric

func PushSetMetric(key string, value int, def DataDef)

func Run

func Run()

func SaveMetrics

func SaveMetrics()

Types

type DataDef

type DataDef struct {
	Max          uint64
	Period       time.Duration
	Label        string
	AggloType    string
	SetOperation string
	Scale        int
	Unit         string
	Decumulate   bool
}

type DataDefDB

type DataDefDB struct {
	Values     []DataDefDBEntry
	ValuesAggl map[string]DataDefDBEntry
	LastUpdate time.Time
	Max        uint64
	Label      string
	Key        string
	AggloType  string
	Scale      int
	Unit       string
}

func AggloMetrics

func AggloMetrics(metricsList []string) []DataDefDB

type DataDefDBEntry

type DataDefDBEntry struct {
	Date      time.Time
	Value     int
	Processed bool

	// For agglomeration
	AvgIndex    int
	AggloTo     time.Time
	AggloExpire time.Time
}

type DataPush

type DataPush struct {
	Date       time.Time
	Key        string
	Value      int
	Max        uint64
	Expire     time.Time
	Label      string
	AvgIndex   int
	AggloType  string
	Scale      int
	Unit       string
	Decumulate bool
}

Jump to

Keyboard shortcuts

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