metrics

package
v1.23.15 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const EndpointSliceMirroringSubsystem = "endpoint_slice_mirroring_controller"

EndpointSliceMirroringSubsystem is the name of the subsystem used for EndpointSliceMirroring controller.

Variables

View Source
var (
	// EndpointsAddedPerSync tracks the number of endpoints added on each
	// Endpoints sync.
	EndpointsAddedPerSync = metrics.NewHistogramVec(
		&metrics.HistogramOpts{
			Subsystem:      EndpointSliceMirroringSubsystem,
			Name:           "endpoints_added_per_sync",
			Help:           "Number of endpoints added on each Endpoints sync",
			StabilityLevel: metrics.ALPHA,
			Buckets:        metrics.ExponentialBuckets(2, 2, 15),
		},
		[]string{},
	)
	// EndpointsUpdatedPerSync tracks the number of endpoints updated on each
	// Endpoints sync.
	EndpointsUpdatedPerSync = metrics.NewHistogramVec(
		&metrics.HistogramOpts{
			Subsystem:      EndpointSliceMirroringSubsystem,
			Name:           "endpoints_updated_per_sync",
			Help:           "Number of endpoints updated on each Endpoints sync",
			StabilityLevel: metrics.ALPHA,
			Buckets:        metrics.ExponentialBuckets(2, 2, 15),
		},
		[]string{},
	)
	// EndpointsRemovedPerSync tracks the number of endpoints removed on each
	// Endpoints sync.
	EndpointsRemovedPerSync = metrics.NewHistogramVec(
		&metrics.HistogramOpts{
			Subsystem:      EndpointSliceMirroringSubsystem,
			Name:           "endpoints_removed_per_sync",
			Help:           "Number of endpoints removed on each Endpoints sync",
			StabilityLevel: metrics.ALPHA,
			Buckets:        metrics.ExponentialBuckets(2, 2, 15),
		},
		[]string{},
	)
	// AddressesSkippedPerSync tracks the number of addresses skipped on each
	// Endpoints sync due to being invalid or exceeding MaxEndpointsPerSubset.
	AddressesSkippedPerSync = metrics.NewHistogramVec(
		&metrics.HistogramOpts{
			Subsystem:      EndpointSliceMirroringSubsystem,
			Name:           "addresses_skipped_per_sync",
			Help:           "Number of addresses skipped on each Endpoints sync due to being invalid or exceeding MaxEndpointsPerSubset",
			StabilityLevel: metrics.ALPHA,
			Buckets:        metrics.ExponentialBuckets(2, 2, 15),
		},
		[]string{},
	)
	// EndpointsSyncDuration tracks how long syncEndpoints() takes in a number
	// of Seconds.
	EndpointsSyncDuration = metrics.NewHistogramVec(
		&metrics.HistogramOpts{
			Subsystem:      EndpointSliceMirroringSubsystem,
			Name:           "endpoints_sync_duration",
			Help:           "Duration of syncEndpoints() in seconds",
			StabilityLevel: metrics.ALPHA,
			Buckets:        metrics.ExponentialBuckets(0.001, 2, 15),
		},
		[]string{},
	)
	// EndpointsDesired tracks the total number of desired endpoints.
	EndpointsDesired = metrics.NewGaugeVec(
		&metrics.GaugeOpts{
			Subsystem:      EndpointSliceMirroringSubsystem,
			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:      EndpointSliceMirroringSubsystem,
			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:      EndpointSliceMirroringSubsystem,
			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:      EndpointSliceMirroringSubsystem,
			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) DeleteEndpoints

func (c *Cache) DeleteEndpoints(endpointsNN types.NamespacedName)

DeleteEndpoints removes references to an Endpoints resource from the global cache and updates the corresponding metrics.

func (*Cache) UpdateEndpointPortCache

func (c *Cache) UpdateEndpointPortCache(endpointsNN types.NamespacedName, epCache *EndpointPortCache)

UpdateEndpointPortCache updates a EndpointPortCache in the global cache for a given Service and updates the corresponding metrics. Parameters: * endpointsNN refers to a NamespacedName representing the Endpoints resource. * epCache refers to a EndpointPortCache for the specified Endpoints reosource.

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 EndpointPortCache

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

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

func NewEndpointPortCache

func NewEndpointPortCache() *EndpointPortCache

NewEndpointPortCache initializes and returns a new EndpointPortCache.

func (*EndpointPortCache) Set

Set updates the EndpointPortCache 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