...

Package metrics

import "k8s.io/kubernetes/pkg/controller/endpointslicemirroring/metrics"
Overview
Index

Overview ▾

Constants

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

const EndpointSliceMirroringSubsystem = "endpoint_slice_mirroring_controller"

Variables

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"},
    )
)

func RegisterMetrics

func RegisterMetrics()

RegisterMetrics registers EndpointSlice metrics.

type Cache

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

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

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

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

type EfficiencyInfo struct {
    Endpoints int
    Slices    int
}

type EndpointPortCache

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

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

func NewEndpointPortCache

func NewEndpointPortCache() *EndpointPortCache

NewEndpointPortCache initializes and returns a new EndpointPortCache.

func (*EndpointPortCache) Set

func (spc *EndpointPortCache) Set(pmKey endpointsliceutil.PortMapKey, eInfo EfficiencyInfo)

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