metrics

package
v0.12.0-unstable39 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 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 PushRequestMetrics

func PushRequestMetrics(route utils.ProxyRouteConfig, statusCode int, TimeStarted time.Time, size int64) error

func PushSetMetric

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

func PushShieldMetrics

func PushShieldMetrics(reason string)

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