metrics

package
v1.29.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (

	// StaticGlobalIPNameKey tells the Ingress controller to use a specific GCE
	// static ip for its forwarding rules. If specified, the Ingress controller
	// assigns the static ip by this name to the forwarding rules of the given
	// Ingress. The controller *does not* manage this ip, it is the users
	// responsibility to create/delete it.
	StaticGlobalIPNameKey = "kubernetes.io/ingress.global-static-ip-name"

	// SSLCertKey is the annotation key used by controller to record GCP ssl cert.
	SSLCertKey = "ingress.kubernetes.io/ssl-cert"
)
View Source
const GLBC_NAMESPACE = "glbc"
View Source
const StatusError = L4ServiceStatus("Error")
View Source
const StatusPersistentError = L4ServiceStatus("PersistentError")
View Source
const StatusSuccess = L4ServiceStatus("Success")
View Source
const StatusUserError = L4ServiceStatus("UserError")

Variables

View Source
var (
	MetricExportFailureCount = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "metric_export_failure",
			Help: "Number of metric export failures",
		},
		[]string{"metric_subset"},
	)
)

Functions

This section is empty.

Types

type ControllerMetrics added in v1.8.2

type ControllerMetrics struct {

	//TODO(kl52752) remove mutex and change map to sync.map
	sync.Mutex
	// contains filtered or unexported fields
}

ControllerMetrics contains the state of the all ingresses.

func FakeControllerMetrics added in v1.17.0

func FakeControllerMetrics() *ControllerMetrics

FakeControllerMetrics creates new ControllerMetrics with fixed 10 minutes metricsInterval, to be used in tests

func NewControllerMetrics added in v1.8.2

func NewControllerMetrics(exportInterval, l4NetLBProvisionDeadline time.Duration, enableNetLBDualStack, enableILBDualStack bool, logger klog.Logger) *ControllerMetrics

NewControllerMetrics initializes ControllerMetrics and starts a go routine to compute and export metrics periodically.

func (*ControllerMetrics) DeleteIngress added in v1.8.2

func (im *ControllerMetrics) DeleteIngress(ingKey string)

DeleteIngress implements IngressMetricsCollector.

func (*ControllerMetrics) DeleteL4ILBService added in v1.9.0

func (im *ControllerMetrics) DeleteL4ILBService(svcKey string)

DeleteL4ILBService deletes L4 ILB service state from L4 NetLB Metrics states map.

func (*ControllerMetrics) DeleteL4ILBServiceForLegacyMetric added in v1.25.0

func (im *ControllerMetrics) DeleteL4ILBServiceForLegacyMetric(svcKey string)

DeleteL4ILBServiceForLegacyMetric deletes service from L4 ILB Legacy Metrics states map.

func (*ControllerMetrics) DeleteL4NetLBService added in v1.16.0

func (im *ControllerMetrics) DeleteL4NetLBService(svcKey string)

DeleteL4NetLBService deletes L4 NetLB service state from L4 NetLB Metrics states map.

func (*ControllerMetrics) DeleteL4NetLBServiceForLegacyMetric added in v1.25.0

func (im *ControllerMetrics) DeleteL4NetLBServiceForLegacyMetric(svcKey string)

DeleteL4NetLBServiceForLegacyMetric deletes service from L4 ILB Legacy Metrics states map.

func (*ControllerMetrics) DeleteService added in v1.13.0

func (im *ControllerMetrics) DeleteService(serviceKey string)

DeleteService removes the service from the map to be counted during metrics computation. DeleteService implements PSCMetricsCollector.

func (*ControllerMetrics) DeleteServiceAttachment added in v1.11.2

func (im *ControllerMetrics) DeleteServiceAttachment(saKey string)

DeleteServiceAttachment removes sa state to the map to be counted during metrics computation. DeleteServiceAttachment implements PSCMetricsCollector.

func (*ControllerMetrics) Run added in v1.8.2

func (im *ControllerMetrics) Run(stopCh <-chan struct{})

func (*ControllerMetrics) SetIngress added in v1.8.2

func (im *ControllerMetrics) SetIngress(ingKey string, ing IngressState)

SetIngress implements IngressMetricsCollector.

func (*ControllerMetrics) SetL4ILBService added in v1.9.0

func (im *ControllerMetrics) SetL4ILBService(svcKey string, state L4ServiceState)

SetL4ILBService adds L4 ILB service state to L4 NetLB Metrics states map.

func (*ControllerMetrics) SetL4ILBServiceForLegacyMetric added in v1.25.0

func (im *ControllerMetrics) SetL4ILBServiceForLegacyMetric(svcKey string, state L4ILBServiceLegacyState)

SetL4ILBServiceForLegacyMetric adds service to the L4 ILB Legacy Metrics states map.

func (*ControllerMetrics) SetL4NetLBService added in v1.16.0

func (im *ControllerMetrics) SetL4NetLBService(svcKey string, state L4ServiceState)

SetL4NetLBService adds L4 NetLB service state to L4 NetLB Metrics states map.

func (*ControllerMetrics) SetL4NetLBServiceForLegacyMetric added in v1.25.0

func (im *ControllerMetrics) SetL4NetLBServiceForLegacyMetric(svcKey string, state L4NetLBServiceLegacyState)

SetL4NetLBServiceForLegacyMetric adds service to the L4 NetLB Legacy Metrics states map.

func (*ControllerMetrics) SetService added in v1.13.0

func (im *ControllerMetrics) SetService(serviceKey string)

SetService adds the service to the map to be counted during metrics computation. SetService implements PSCMetricsCollector.

func (*ControllerMetrics) SetServiceAttachment added in v1.11.2

func (im *ControllerMetrics) SetServiceAttachment(saKey string, state pscmetrics.PSCState)

SetServiceAttachment adds sa state to the map to be counted during metrics computation. SetServiceAttachment implements PSCMetricsCollector.

type IngressMetricsCollector added in v1.8.2

type IngressMetricsCollector interface {
	// SetIngress adds/updates ingress state for given ingress key.
	SetIngress(ingKey string, ing IngressState)
	// DeleteIngress removes the given ingress key.
	DeleteIngress(ingKey string)
}

IngressMetricsCollector is an interface to update/delete ingress states in the cache that is used for computing ingress usage metrics.

type IngressState added in v1.8.2

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

IngressState defines an ingress and its associated service ports.

func NewIngressState added in v1.8.2

func NewIngressState(ing *v1.Ingress, fc *frontendconfigv1beta1.FrontendConfig, svcPorts []utils.ServicePort) IngressState

NewIngressState returns ingress state for given ingress and service ports.

type L4DualStackServiceLabels added in v1.22.0

type L4DualStackServiceLabels struct {
	// IPFamilies stores spec.ipFamilies of Service
	IPFamilies string
	// IPFamilyPolicy specifies spec.IPFamilyPolicy of Service
	IPFamilyPolicy string
}

L4DualStackServiceLabels defines ipFamilies, ipFamilyPolicy of L4 DualStack service

type L4FeaturesServiceLabels added in v1.25.0

type L4FeaturesServiceLabels struct {
	// Multinetwork specifies if the service is a multinetworked service
	Multinetwork bool
	// StrongSessionAffinity is true if String Session Affinity is enabled
	StrongSessionAffinity bool
}

L4FeaturesServiceLabels defines various properties we want to track for L4 LBs

type L4ILBMetricsCollector added in v1.9.0

type L4ILBMetricsCollector interface {
	// SetL4ILBServiceForLegacyMetric adds/updates L4 ILB service state for given service key.
	SetL4ILBServiceForLegacyMetric(svcKey string, state L4ILBServiceLegacyState)
	// DeleteL4ILBServiceForLegacyMetric removes the given L4 ILB service key.
	DeleteL4ILBServiceForLegacyMetric(svcKey string)
}

L4ILBMetricsCollector is an interface to update/delete L4 ILb service states in the cache that is used for computing L4 ILB usage metrics.

type L4ILBServiceLegacyState added in v1.25.0

type L4ILBServiceLegacyState struct {
	// EnabledGlobalAccess specifies if Global Access is enabled.
	EnabledGlobalAccess bool
	// EnabledCustomSubNet specifies if Custom Subnet is enabled.
	EnabledCustomSubnet bool
	// InSuccess specifies if the ILB service VIP is configured.
	InSuccess bool
	// IsUserError specifies if the error was caused by User misconfiguration.
	IsUserError bool
}

L4ILBServiceLegacyState defines if global access and subnet features are enabled for an L4 ILB service.

type L4NetLBServiceLegacyState added in v1.25.0

type L4NetLBServiceLegacyState struct {
	// IsManagedIP specifies if Static IP is managed by controller.
	IsManagedIP bool
	// IsPremiumTier specifies if network tier for forwarding rule is premium.
	IsPremiumTier bool
	// InSuccess specifies if the NetLB service VIP is configured.
	InSuccess bool
	// IsUserError specifies if the error was caused by User misconfiguration.
	IsUserError bool
	// FirstSyncErrorTime specifies the time timestamp when the service sync ended up with error for the first time.
	FirstSyncErrorTime *time.Time
}

L4NetLBServiceLegacyState defines if network tier is premium and if static ip address is managed by controller for an L4 NetLB service.

func InitL4NetLBServiceLegacyState added in v1.25.0

func InitL4NetLBServiceLegacyState(syncTime *time.Time) L4NetLBServiceLegacyState

InitL4NetLBServiceLegacyState created and inits the L4NetLBServiceLegacyState struct by setting FirstSyncErrorTime.

type L4ServiceState added in v1.25.0

type L4ServiceState struct {
	L4DualStackServiceLabels
	L4FeaturesServiceLabels
	// Status specifies status of an L4 Service
	Status L4ServiceStatus
	// FirstSyncErrorTime specifies the time timestamp when the service sync ended up with error for the first time.
	FirstSyncErrorTime *time.Time
}

L4ServiceState tracks the state of an L4 service. It includes data needed to fill various L4 metrics plus the status of the service. FirstSyncErrorTime of an L4 service

func InitServiceMetricsState added in v1.25.0

func InitServiceMetricsState(svc *corev1.Service, startTime *time.Time, isMultinetwork bool, enabledStrongSessionAffinity bool) L4ServiceState

type L4ServiceStatus added in v1.25.0

type L4ServiceStatus string

Jump to

Keyboard shortcuts

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