metrics

package
v0.15.7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 23 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_ListEvents

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

func API_ResetMetrics

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

func AggloAndCommitMetrics

func AggloAndCommitMetrics()

func CheckAlerts

func CheckAlerts(TrackingMetric string, Period string, metric utils.AlertMetricTrack, Value int)

func CommitAggl

func CommitAggl(metrics []DataDefDB)

func ExecuteAction

func ExecuteAction(alert utils.Alert, action utils.AlertAction, metric utils.AlertMetricTrack)

func ExecuteAllActions

func ExecuteAllActions(alert utils.Alert, actions []utils.AlertAction, metric utils.AlertMetricTrack)

func GetDataBuffer added in v0.15.0

func GetDataBuffer() map[string]DataPush

func GetSystemMetrics

func GetSystemMetrics()

func Init

func Init()

func InitAggl

func InitAggl()

func ListMetrics

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

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
	DecumulatePos bool
	Object        string
}

type DataDefDB

type DataDefDB struct {
	Values     []DataDefDBEntry
	ValuesAggl map[string]DataDefDBEntry
	LastUpdate time.Time
	TimeScale  float64
	Max        uint64
	Label      string
	Key        string
	AggloType  string
	Scale      int
	Unit       string
	Object     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
	Period        time.Duration
	Expire        time.Time
	Label         string
	AvgIndex      int
	AggloType     string
	Scale         int
	Unit          string
	Decumulate    bool
	DecumulatePos bool
	Object        string
}

type Event

type Event struct {
	Id          primitive.ObjectID     `json:"id" bson:"_id"`
	Label       string                 `json:"label" bson:"label"`
	Application string                 `json:"application" bson:"application"`
	EventId     string                 `json:"eventId" bson:"eventId"`
	Date        time.Time              `json:"date" bson:"date"`
	Level       string                 `json:"level" bson:"level"`
	Data        map[string]interface{} `json:"data" bson:"data"`
	Object      string                 `json:"object" bson:"object"`
}

type MetricList

type MetricList struct {
	Key   string
	Label string
}

Jump to

Keyboard shortcuts

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