metrics

package
v1.6.8 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PrintLog   = true
	DonotPrint = false
)

Functions

func AddEntryToIPSet

func AddEntryToIPSet(setName string)

AddEntryToIPSet increments the number of entries for IPSet setName. It doesn't ever update the number of IPSets.

func AddPod

func AddPod()

AddPod increments the number of Pod IPs.

func CreateTelemetryHandle

func CreateTelemetryHandle(npmVersionNum int, imageVersion, aiMetadata string) error

CreateTelemetryHandle creates a handler to initialize AI telemetry

func DecNumACLRules

func DecNumACLRules()

DecNumACLRules decrements the number of ACL rules.

func DecNumACLRulesBy

func DecNumACLRulesBy(amount int)

DecNumACLRulesBy decrements the number of ACL rules by the amount.

func DecNumIPSets

func DecNumIPSets()

DecNumIPSets decrements the number of IPSets.

func DecNumPolicies

func DecNumPolicies()

DecNumPolicies decrements the number of policies.

func DeleteIPSet

func DeleteIPSet(setName string)

DeleteIPSet decrements the number of IPSets and resets the number of entries for ipset setName to 0.

func GetACLRuleExecCount

func GetACLRuleExecCount() (int, error)

GetACLRuleExecCount returns the number of observations for execution time of adding ACL rules. This function is slow.

func GetControllerNamespaceExecCount

func GetControllerNamespaceExecCount(op OperationKind, hadError bool) (int, error)

GetControllerNamespaceExecCount returns the number of observations for namespace exec time for the specified operation. This function is slow.

func GetControllerPodExecCount

func GetControllerPodExecCount(op OperationKind, hadError bool) (int, error)

GetControllerPodExecCount returns the number of observations for pod exec time for the specified operation. This function is slow.

func GetControllerPolicyExecCount

func GetControllerPolicyExecCount(op OperationKind, hadError bool) (int, error)

GetControllerPolicyExecCount returns the number of observations for policy exec time for the specified operation. This function is slow.

func GetHandler

func GetHandler(registryType RegistryType) http.Handler

GetHandler returns the HTTP handler for the metrics endpoint

func GetIPSetExecCount

func GetIPSetExecCount() (int, error)

GetIPSetExecCount returns the number of observations for execution time of adding IPSets. This function is slow.

func GetNumACLRules

func GetNumACLRules() (int, error)

GetNumACLRules returns the number of ACL rules. This function is slow.

func GetNumEntriesForIPSet

func GetNumEntriesForIPSet(setName string) (int, error)

GetNumEntriesForIPSet returns the number entries for IPSet setName. This function is slow. TODO could use the map if this function needs to be faster. If updated, replace GetNumEntriesForIPSet() with getVecValue() in assertEqualMapAndMetricElements() in ipsets_test.go

func GetNumIPSetEntries

func GetNumIPSetEntries() (int, error)

GetNumIPSetEntries returns the total number of IPSet entries. This function is slow.

func GetNumIPSets

func GetNumIPSets() (int, error)

GetNumIPSets returns the number of IPSets. This function is slow.

func GetNumPolicies

func GetNumPolicies() (int, error)

GetNumPolicies returns the number of policies. This function is slow.

func IncIPTablesRestoreFailures

func IncIPTablesRestoreFailures(op OperationKind)

func IncNumACLRules

func IncNumACLRules()

IncNumACLRules increments the number of ACL rules.

func IncNumACLRulesBy

func IncNumACLRulesBy(amount int)

IncNumACLRulesBy increments the number of ACL rules by the amount.

func IncNumIPSets

func IncNumIPSets()

IncNumIPSets increments the number of IPSets.

func IncNumPolicies

func IncNumPolicies()

IncNumPolicies increments the number of policies.

func InitializeAll

func InitializeAll()

InitializeAll creates the Controller and Daemon Prometheus Metrics. The metrics will be nil before this method is called. TODO consider refactoring the functionality of the metrics package into a "Metrics" struct with methods (this would require code changes throughout npm). Would need to consider how it seems like you can't register a metric twice, even in a separate registry, so you couldn't throw away the Metrics struct and create a new one.

func InitializeLinuxMetrics

func InitializeLinuxMetrics()

func InitializeWindowsMetrics

func InitializeWindowsMetrics()

InitializeWindowsMetrics should NOT be called externally except for resetting metrics for UTs.

func NumIPSetsIsPositive

func NumIPSetsIsPositive() bool

NumIPSetsIsPositive is true when the number of IPSets is positive. This function is slow. TODO might be more efficient to keep track of the count

func PodCount

func PodCount() (int, error)

PodCount gets the current number of Pod IPs. This function is slow.

func RecordACLRuleExecTime

func RecordACLRuleExecTime(timer *Timer)

RecordACLRuleExecTime adds an observation of execution time for adding an ACL rule. The execution time is from the timer's start until now. NOTE: see acls_windows.go for more precise Windows metrics.

func RecordControllerNamespaceExecTime

func RecordControllerNamespaceExecTime(timer *Timer, op OperationKind, hadError bool)

RecordControllerNamespaceExecTime adds an observation of namespace exec time (unless the operation is NoOp). The execution time is from the timer's start until now.

func RecordControllerPodExecTime

func RecordControllerPodExecTime(timer *Timer, op OperationKind, hadError bool)

RecordControllerPodExecTime adds an observation of pod exec time for the specified operation (unless the operation is NoOp). The execution time is from the timer's start until now.

func RecordControllerPolicyExecTime

func RecordControllerPolicyExecTime(timer *Timer, op OperationKind, hadError bool)

RecordControllerPolicyExecTime adds an observation of policy exec time (unless the operation is NoOp). The execution time is from the timer's start until now.

func RecordIPSetExecTime

func RecordIPSetExecTime(timer *Timer)

RecordIPSetExecTime adds an observation of execution time for adding an IPSet. The execution time is from the timer's start until now.

func RecordIPTablesDeleteLatency

func RecordIPTablesDeleteLatency(timer *Timer)

func RecordIPTablesRestoreLatency

func RecordIPTablesRestoreLatency(timer *Timer, op OperationKind)

func ReinitializeAll

func ReinitializeAll()

ReinitializeAll creates/replaces Prometheus metrics. This function is intended for UTs.

func RemoveAllEntriesFromIPSet

func RemoveAllEntriesFromIPSet(setName string)

RemoveAllEntriesFromIPSet sets the number of entries for ipset setName to 0. It doesn't ever update the number of IPSets.

func RemoveEntryFromIPSet

func RemoveEntryFromIPSet(setName string)

RemoveEntryFromIPSet decrements the number of entries for IPSet setName.

func RemovePod

func RemovePod()

RemovePod decrements the number of Pod IPs.

func ResetIPSetEntries

func ResetIPSetEntries()

ResetIPSetEntries sets the number of entries to 0 for all IPSets. It doesn't ever update the number of IPSets.

func ResetNumACLRules

func ResetNumACLRules()

ResetNumACLRules sets the number of ACL rules to 0.

func ResetNumIPSets

func ResetNumIPSets()

ResetNumIPSets sets the number of IPSets to 0.

func ResetNumPolicies

func ResetNumPolicies()

ResetNumPolicies sets the number of policies to 0.

func SendErrorLogAndMetric

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

SendErrorLogAndMetric sends a metric through AI telemetry and sends a log to the Kusto Messages table

func SendHeartbeatWithNumPolicies

func SendHeartbeatWithNumPolicies()

func SendLog

func SendLog(operationID int, msg string, printLog bool)

SendLog sends log

func SendMetric

func SendMetric(metric aitelemetry.Metric)

SendMetric sends metrics

func SetNumIPSets

func SetNumIPSets(val int)

SetNumIPSets sets the number of IPsets to val.

func TotalIPTablesDeleteLatencyCalls

func TotalIPTablesDeleteLatencyCalls() (int, error)

func TotalIPTablesRestoreFailures

func TotalIPTablesRestoreFailures(op OperationKind) (int, error)

func TotalIPTablesRestoreLatencyCalls

func TotalIPTablesRestoreLatencyCalls(op OperationKind) (int, error)

Types

type OperationKind

type OperationKind string
const (
	CreateOp OperationKind = "create"
	UpdateOp OperationKind = "update"
	DeleteOp OperationKind = "delete"
	NoOp     OperationKind = "noop"
)

type RegistryType

type RegistryType string
const (
	NodeMetrics    RegistryType = "node-metrics"
	ClusterMetrics RegistryType = "cluster-metrics"
)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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