metrics

package
v1.21.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const EndpointSliceSubsystem = "endpoint_slice_controller"

EndpointSliceSubsystem - subsystem name used for Endpoint Slices.

Variables

View Source
var (
	// EndpointsAddedPerSync tracks the number of endpoints added on each
	// Service sync.
	EndpointsAddedPerSync = metrics.NewHistogramVec(
		&metrics.HistogramOpts{
			Subsystem:      EndpointSliceSubsystem,
			Name:           "endpoints_added_per_sync",
			Help:           "Number of endpoints added on each Service sync",
			StabilityLevel: metrics.ALPHA,
			Buckets:        metrics.ExponentialBuckets(2, 2, 15),
		},
		[]string{},
	)
	// EndpointsRemovedPerSync tracks the number of endpoints removed on each
	// Service sync.
	EndpointsRemovedPerSync = metrics.NewHistogramVec(
		&metrics.HistogramOpts{
			Subsystem:      EndpointSliceSubsystem,
			Name:           "endpoints_removed_per_sync",
			Help:           "Number of endpoints removed on each Service sync",
			StabilityLevel: metrics.ALPHA,
			Buckets:        metrics.ExponentialBuckets(2, 2, 15),
		},
		[]string{},
	)
	// EndpointsDesired tracks the total number of desired endpoints.
	EndpointsDesired = metrics.NewGaugeVec(
		&metrics.GaugeOpts{
			Subsystem:      EndpointSliceSubsystem,
			Name:           "endpoints_desired",
			Help:           "Number of endpoints desired",
			StabilityLevel: metrics.ALPHA,
		},
		[]string{},
	)
	// NumEndpointSlices tracks the number of EndpointSlices in a cluster.
	NumEndpointSlices = metrics.NewGaugeVec(
		&metrics.GaugeOpts{
			Subsystem:      EndpointSliceSubsystem,
			Name:           "num_endpoint_slices",
			Help:           "Number of EndpointSlices",
			StabilityLevel: metrics.ALPHA,
		},
		[]string{},
	)
	// DesiredEndpointSlices tracks the number of EndpointSlices that would
	// exist with perfect endpoint allocation.
	DesiredEndpointSlices = metrics.NewGaugeVec(
		&metrics.GaugeOpts{
			Subsystem:      EndpointSliceSubsystem,
			Name:           "desired_endpoint_slices",
			Help:           "Number of EndpointSlices that would exist with perfect endpoint allocation",
			StabilityLevel: metrics.ALPHA,
		},
		[]string{},
	)

	// EndpointSliceChanges tracks the number of changes to Endpoint Slices.
	EndpointSliceChanges = metrics.NewCounterVec(
		&metrics.CounterOpts{
			Subsystem:      EndpointSliceSubsystem,
			Name:           "changes",
			Help:           "Number of EndpointSlice changes",
			StabilityLevel: metrics.ALPHA,
		},
		[]string{"operation"},
	)
)

Functions

func RegisterMetrics

func RegisterMetrics()

RegisterMetrics registers EndpointSlice metrics.

Types

type Cache

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

Cache tracks values for total numbers of desired endpoints as well as the efficiency of EndpointSlice endpoints distribution.

func NewCache

func NewCache(endpointsPerSlice int32) *Cache

NewCache returns a new Cache with the specified endpointsPerSlice.

func (*Cache) DeleteService

func (c *Cache) DeleteService(serviceNN types.NamespacedName)

DeleteService removes references of a Service from the global cache and updates the corresponding metrics.

func (*Cache) UpdateServicePortCache

func (c *Cache) UpdateServicePortCache(serviceNN types.NamespacedName, spCache *ServicePortCache)

UpdateServicePortCache updates a ServicePortCache in the global cache for a given Service and updates the corresponding metrics. Parameters: * serviceNN refers to a NamespacedName representing the Service. * spCache refers to a ServicePortCache for the specified Service.

type EfficiencyInfo

type EfficiencyInfo struct {
	Endpoints int
	Slices    int
}

EfficiencyInfo stores the number of Endpoints and Slices for calculating total numbers of desired endpoints and the efficiency of EndpointSlice endpoints distribution.

type ServicePortCache

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

ServicePortCache tracks values for total numbers of desired endpoints as well as the efficiency of EndpointSlice endpoints distribution for each unique Service Port combination.

func NewServicePortCache

func NewServicePortCache() *ServicePortCache

NewServicePortCache initializes and returns a new ServicePortCache.

func (*ServicePortCache) Set

func (spc *ServicePortCache) Set(pmKey endpointutil.PortMapKey, eInfo EfficiencyInfo)

Set updates the ServicePortCache to contain the provided EfficiencyInfo for the provided PortMapKey.

Jump to

Keyboard shortcuts

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