metrics

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	GCProcess   = "GC"
	SyncProcess = "Sync"
)

Variables

View Source
var (
	NumberOfEndpoints = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Subsystem: negControllerSubsystem,
			Name:      numberOfEndpoints,
			Help:      "The total number of endpoints",
		},
		endpointAnnotationLabels,
	)

	LabelNumber = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Subsystem: negControllerSubsystem,
			Name:      labelNumber,
			Help:      "The number of labels per endpoint",

			Buckets: prometheus.ExponentialBuckets(1, 2, 13),
		},
	)

	AnnotationSize = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Subsystem: negControllerSubsystem,
			Name:      annotationSize,
			Help:      "The size in byte of endpoint annotations per endpoint",

			Buckets: prometheus.ExponentialBuckets(1, 2, 13),
		},
	)

	LabelPropagationError = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: negControllerSubsystem,
			Name:      labelErrorNumber,
			Help:      "the number of errors occurred for label propagation",
		},
		labelPropagationErrorLabels,
	)
)
View Source
var (
	NegOperationLatency = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Subsystem: negControllerSubsystem,
			Name:      negOpLatencyKey,
			Help:      "Latency of a NEG Operation",

			Buckets: prometheus.ExponentialBuckets(1, 2, 13),
		},
		negOpLatencyMetricsLabels,
	)

	NegOperationEndpoints = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Subsystem: negControllerSubsystem,
			Name:      negOpEndpointsKey,
			Help:      "Number of Endpoints during an NEG Operation",

			Buckets: prometheus.ExponentialBuckets(1, 2, 13),
		},
		negOpEndpointsMetricsLabels,
	)

	SyncerSyncLatency = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Subsystem: negControllerSubsystem,
			Name:      syncerLatencyKey,
			Help:      "Sync latency for NEG Syncer",

			Buckets: prometheus.ExponentialBuckets(1, 2, 13),
		},
		syncerMetricsLabels,
	)

	ManagerProcessLatency = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Subsystem: negControllerSubsystem,
			Name:      managerProcessLatencyKey,
			Help:      "Process latency for NEG Manager",

			Buckets: prometheus.ExponentialBuckets(1, 2, 13),
		},
		negProcessMetricsLabels,
	)

	InitializationLatency = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Subsystem: negControllerSubsystem,
			Name:      initLatencyKey,
			Help:      "Initialization latency of a NEG",

			Buckets: prometheus.ExponentialBuckets(1, 2, 13),
		},
	)

	LastSyncTimestamp = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Subsystem: negControllerSubsystem,
			Name:      lastSyncTimestampKey,
			Help:      "The timestamp of the last execution of NEG controller sync loop.",
		},
	)

	// SyncerStaleness tracks for every syncer, how long since the syncer last syncs
	SyncerStaleness = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Subsystem: negControllerSubsystem,
			Name:      syncerStalenessKey,
			Help:      "The duration of a syncer since it last syncs",
		},
	)

	// EPSStaleness tracks for every endpoint slice, how long since it was last processed
	EPSStaleness = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Subsystem: negControllerSubsystem,
			Name:      epsStalenessKey,
			Help:      "The duration for an endpoint slice since it was last processed by syncer",

			Buckets: prometheus.ExponentialBuckets(1, 2, 14),
		},
	)
)

Functions

func PublishAnnotationMetrics added in v1.23.0

func PublishAnnotationMetrics(annotationSize int, labelNumber int)

PublishAnnotationMetrics publishes collected metrics for endpoint annotations.

func PublishLabelPropagationError added in v1.23.0

func PublishLabelPropagationError(errType string)

PublishLabelPropagationError publishes error occured during label propagation.

func PublishNegEPSStalenessMetrics added in v1.22.0

func PublishNegEPSStalenessMetrics(epsStaleness time.Duration)

func PublishNegInitializationMetrics added in v1.10.2

func PublishNegInitializationMetrics(latency time.Duration)

PublishNegInitializationMetrics publishes collected metrics for time from request to initialization of NEG

func PublishNegManagerProcessMetrics added in v1.10.2

func PublishNegManagerProcessMetrics(process string, err error, start time.Time)

PublishNegManagerProcessMetrics publishes collected metrics for the neg manager loops

func PublishNegOperationMetrics added in v1.10.2

func PublishNegOperationMetrics(operation, negType, apiVersion string, err error, numEndpoints int, start time.Time)

PublishNegOperationMetrics publishes collected metrics for neg operations

func PublishNegSyncMetrics added in v1.10.2

func PublishNegSyncMetrics(negType, endpointCalculator string, err error, start time.Time)

PublishNegSyncMetrics publishes collected metrics for the sync of NEG

func PublishNegSyncerStalenessMetrics added in v1.22.0

func PublishNegSyncerStalenessMetrics(syncerStaleness time.Duration)

func RegisterMetrics

func RegisterMetrics()

func RegisterSyncerMetrics added in v1.22.0

func RegisterSyncerMetrics()

RegisterSyncerMetrics registers syncer related metrics

Types

type LabelPropagationMetrics added in v1.23.0

type LabelPropagationMetrics struct {
	EndpointsWithAnnotation int
	NumberOfEndpoints       int
}

LabelPropagationMetrics contains aggregated label propagation related metrics.

type LabelPropagationStats added in v1.23.0

type LabelPropagationStats struct {
	EndpointsWithAnnotation int
	NumberOfEndpoints       int
}

LabelPropagationStat contains stats related to label propagation.

type SyncerMetrics added in v1.22.0

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

func FakeSyncerMetrics added in v1.22.0

func FakeSyncerMetrics() *SyncerMetrics

FakeSyncerMetrics creates new NegMetricsCollector with fixed 5 second metricsInterval, to be used in tests

func NewNegMetricsCollector added in v1.22.0

func NewNegMetricsCollector(exportInterval time.Duration, logger klog.Logger) *SyncerMetrics

NewNEGMetricsCollector initializes SyncerMetrics and starts a go routine to compute and export metrics periodically.

func (*SyncerMetrics) Run added in v1.22.0

func (sm *SyncerMetrics) Run(stopCh <-chan struct{})

func (*SyncerMetrics) SetLabelPropagationStats added in v1.23.0

func (sm *SyncerMetrics) SetLabelPropagationStats(key negtypes.NegSyncerKey, labelstatLabelPropagationStats LabelPropagationStats)

func (*SyncerMetrics) SetSyncerEPMetrics added in v1.23.0

func (sm *SyncerMetrics) SetSyncerEPMetrics(key negtypes.NegSyncerKey, endpointStat *negtypes.SyncerEPStat)

SetSyncerEPMetrics update the endpoint count based on the endpointStat

func (*SyncerMetrics) UpdateSyncer added in v1.22.0

func (sm *SyncerMetrics) UpdateSyncer(key negtypes.NegSyncerKey, syncResult *negtypes.NegSyncResult)

UpdateSyncer update the status of corresponding syncer based on the syncResult.

type SyncerMetricsCollector added in v1.22.0

type SyncerMetricsCollector interface {
	UpdateSyncer(key negtypes.NegSyncerKey, result *negtypes.NegSyncResult)
	SetSyncerEPMetrics(key negtypes.NegSyncerKey, epState *negtypes.SyncerEPStat)
	SetLabelPropagationStats(key negtypes.NegSyncerKey, labelstatLabelPropagationStats LabelPropagationStats)
}

Jump to

Keyboard shortcuts

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