Documentation ¶
Index ¶
- Variables
- func AddEntryToIPSet(setName string)
- func CreateTelemetryHandle(npmVersionNum int, imageVersion, aiMetadata string) error
- func DecNumACLRules()
- func DecNumACLRulesBy(amount int)
- func DecNumIPSets()
- func DecNumPolicies()
- func DeleteIPSet(setName string)
- func GetACLRuleExecCount() (int, error)
- func GetControllerNamespaceExecCount(op OperationKind, hadError bool) (int, error)
- func GetControllerPodExecCount(op OperationKind, hadError bool) (int, error)
- func GetControllerPolicyExecCount(op OperationKind, hadError bool) (int, error)
- func GetHandler(registryType RegistryType) http.Handler
- func GetIPSetExecCount() (int, error)
- func GetNumACLRules() (int, error)
- func GetNumEntriesForIPSet(setName string) (int, error)
- func GetNumIPSetEntries() (int, error)
- func GetNumIPSets() (int, error)
- func GetNumPolicies() (int, error)
- func IncNumACLRules()
- func IncNumACLRulesBy(amount int)
- func IncNumIPSets()
- func IncNumPolicies()
- func InitializeAll()
- func NumIPSetsIsPositive() bool
- func RecordACLRuleExecTime(timer *Timer)
- func RecordControllerNamespaceExecTime(timer *Timer, op OperationKind, hadError bool)
- func RecordControllerPodExecTime(timer *Timer, op OperationKind, hadError bool)
- func RecordControllerPolicyExecTime(timer *Timer, op OperationKind, hadError bool)
- func RecordIPSetExecTime(timer *Timer)
- func ReinitializeAll()
- func RemoveAllEntriesFromIPSet(setName string)
- func RemoveEntryFromIPSet(setName string)
- func ResetIPSetEntries()
- func ResetNumACLRules()
- func ResetNumIPSets()
- func ResetNumPolicies()
- func SendErrorLogAndMetric(operationID int, format string, args ...interface{})
- func SendHeartbeatWithNumPolicies()
- func SendLog(operationID int, msg string, printLog bool)
- func SendMetric(metric aitelemetry.Metric)
- func SetNumIPSets(val int)
- type OperationKind
- type RegistryType
- type Timer
Constants ¶
This section is empty.
Variables ¶
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 CreateTelemetryHandle ¶
CreateTelemetryHandle creates a handler to initialize AI telemetry
func DecNumACLRulesBy ¶
func DecNumACLRulesBy(amount int)
DecNumACLRulesBy decrements the number of ACL rules by the amount.
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 ¶
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 ¶
GetIPSetExecCount returns the number of observations for execution time of adding IPSets. This function is slow.
func GetNumACLRules ¶
GetNumACLRules returns the number of ACL rules. This function is slow.
func GetNumEntriesForIPSet ¶
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 ¶
GetNumIPSetEntries returns the total number of IPSet entries. This function is slow.
func GetNumIPSets ¶
GetNumIPSets returns the number of IPSets. This function is slow.
func GetNumPolicies ¶
GetNumPolicies returns the number of policies. This function is slow.
func IncNumACLRulesBy ¶
func IncNumACLRulesBy(amount int)
IncNumACLRulesBy increments the number of ACL rules by the amount.
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 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 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.
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 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 ResetIPSetEntries ¶
func ResetIPSetEntries()
ResetIPSetEntries sets the number of entries to 0 for all IPSets. It doesn't ever update the number of IPSets.
func SendErrorLogAndMetric ¶
SendErrorLogAndMetric sends a metric through AI telemetry and sends a log to the Kusto Messages table
func SendHeartbeatWithNumPolicies ¶
func SendHeartbeatWithNumPolicies()
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" )