metrics

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SetNameLabel = "set_name"
	SetHashLabel = "set_hash"
)

Constants for metric names and descriptions as well as exported labels for Vector metrics

Variables

View Source
var (
	NumPolicies            prometheus.Gauge
	AddPolicyExecTime      prometheus.Summary
	NumIPTableRules        prometheus.Gauge
	AddIPTableRuleExecTime prometheus.Summary
	NumIPSets              prometheus.Gauge
	AddIPSetExecTime       prometheus.Summary
	NumIPSetEntries        prometheus.Gauge

	// IPSetInventory should not be referenced directly. Use the functions in ipset-inventory.go
	IPSetInventory *prometheus.GaugeVec
)

Prometheus Metrics Gauge metrics have the methods Inc(), Dec(), and Set(float64) Summary metrics has the method Observe(float64) For any Vector metric, you can call With(prometheus.Labels) before the above methods

e.g. SomeGaugeVec.With(prometheus.Labels{label1: val1, label2: val2, ...).Dec()

Functions

func CreateTelemetryHandle

func CreateTelemetryHandle(version, aiMetadata string) error

CreateTelemetryHandle creates a handler to initialize AI telemetry

func DecIPSetInventory added in v1.1.7

func DecIPSetInventory(setName string)

DecIPSetInventory decreases the number of entries in an IPSet and updates a Prometheus metric.

func GetHandler

func GetHandler(isNodeLevel bool) http.Handler

getHandler returns the HTTP handler for the metrics endpoint

func GetIPSetInventory added in v1.1.7

func GetIPSetInventory(setName string) int

GetIPSetInventory returns the number of entries in an IPSet, or 0 if the set doesn't exist.

func GetIPSetInventoryLabels added in v1.1.7

func GetIPSetInventoryLabels(setName string) prometheus.Labels

GetIPSetInventoryLabels returns the labels for the IPSetInventory GaugeVec for a given setName.

func GetRegistry added in v1.2.8

func GetRegistry(isNodeLevel bool) *prometheus.Registry

func IncIPSetInventory added in v1.1.7

func IncIPSetInventory(setName string)

IncIPSetInventory increases the number of entries in an IPSet and updates a Prometheus metric.

func InitializeAll

func InitializeAll()

InitializeAll creates all the Prometheus Metrics. The metrics will be nil before this method is called.

func ReInitializeAllMetrics added in v1.2.9

func ReInitializeAllMetrics()

func SendErrorLogAndMetric

func SendErrorLogAndMetric(operationID int, format string, args ...interface{})

SendErrorLogAndMetric is responsible for sending log and error metrics through AI telemetry

func SendLog

func SendLog(report aitelemetry.Report)

SendLog sends log

func SendMetric

func SendMetric(metric aitelemetry.Metric)

SendMetric sends metrics

func SetIPSetInventory added in v1.1.7

func SetIPSetInventory(setName string, val int)

SetIPSetInventory sets the number of entries in an IPSet and updates a Prometheus metric.

Types

type Timer

type Timer struct {
	// contains filtered or unexported fields
}

Timer is a one-time-use tool for recording time between a start and end point

func StartNewTimer

func StartNewTimer() *Timer

StartNewTimer creates a new Timer

func (*Timer) StopAndRecord added in v1.1.5

func (timer *Timer) StopAndRecord(observer prometheus.Summary)

StopAndRecord ends a timer and records its delta in a summary

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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