metrics

package
v1.31.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

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

	NotInDegradedEndpoints  = "not_in_degraded_endpoints"
	OnlyInDegradedEndpoints = "only_in_degraded_endpoints"

	// Classification of API Requests
	GetRequest            = "Get"
	CreateRequest         = "Create"
	DeleteRequest         = "Delete"
	UpdateRequest         = "Update"
	PatchRequest          = "Patch"
	ListRequest           = "List"
	AggregatedListRequest = "AggregatedList"
	AttachNERequest       = "AttachNE"
	DetachNERequest       = "Detach"
	ListNERequest         = "ListNE"
	ListNEHealthRequest   = "ListNEHealth"
)

Variables

View Source
var (
	NegOperationLatency = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Subsystem: negControllerSubsystem,
			Name:      "neg_operation_duration_seconds",
			Help:      "Latency of a NEG Operation",

			Buckets: prometheus.ExponentialBuckets(1, 2, 13),
		},
		[]string{
			"operation",
			"neg_type",
			"api_version",
			"result",
		},
	)

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

			Buckets: prometheus.ExponentialBuckets(1, 2, 13),
		},
		[]string{
			"operation",
			"neg_type",
			"result",
		},
	)

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

			Buckets: prometheus.ExponentialBuckets(1, 2, 13),
		},
		[]string{
			"neg_type",
			"endpoint_calculator_mode",
			"result",
		},
	)

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

			Buckets: prometheus.ExponentialBuckets(1, 2, 13),
		},
		[]string{
			"process",
			"result",
		},
	)

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

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

	LastSyncTimestamp = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Subsystem: negControllerSubsystem,
			Name:      "sync_timestamp",
			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:      "syncer_staleness",
			Help:      "The duration of a syncer since it last syncs",

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

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

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

	DegradeModeCorrectness = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Subsystem: negControllerSubsystem,
			Name:      "degraded_mode_correctness",
			Help:      "Number of endpoints differed between current endpoint calculation and degraded mode calculation",

			Buckets: append([]float64{0}, prometheus.ExponentialBuckets(1, 2, 20)...),
		},
		[]string{
			"neg_type",
			"endpoint_type",
		},
	)

	// NegControllerErrorCount tracks the count of server errors(GCE/K8s) and
	// all errors from NEG controller.
	NegControllerErrorCount = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: negControllerSubsystem,
			Name:      "error_count",
			Help:      "Counts of server errors and NEG controller errors.",
		},
		[]string{"error_type"},
	)

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

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

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

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

	LabelPropagationError = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: negControllerSubsystem,
			Name:      "label_propagation_error_count",
			Help:      "the number of errors occurred for label propagation",
		},
		[]string{"error_type"},
	)

	// GCERequestCount tracks the number of GCE requests the neg controller sends to the NEG API
	GCERequestCount = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: negControllerSubsystem,
			Name:      "gce_request_count",
			Help:      "Number of requests sent by NEG Controller to Arcus.",
		},
		[]string{"request", "result"},
	)

	// GCERequestLatency tracks the latency of GCE requests the neg controller sends to the NEG API
	GCERequestLatency = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Subsystem: negControllerSubsystem,
			Name:      "gce_request_latency",
			Help:      "Observed request latency for requests sent by NEG Controller to Arcus.",

			Buckets: append([]float64{0.001, 0.01, 0.1}, prometheus.ExponentialBuckets(1, 2, 20)...),
		},
		[]string{"request", "result"},
	)

	// K8sRequestCount tracks the number of K8s requests the neg controller sends to the K8s API
	K8sRequestCount = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: negControllerSubsystem,
			Name:      "k8s_request_count",
			Help:      "Number of requests sent by NEG Controller to Kubernetes API Server.",
		},
		[]string{"request", "result"},
	)

	// K8sRequestLatency tracks the latency of K8s requests the neg controller sends to the K8s API
	K8sRequestLatency = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Subsystem: negControllerSubsystem,
			Name:      "k8s_request_latency",
			Help:      "Observed request latency for requests sent by NEG Controller to Kubernetes API Server.",

			Buckets: append([]float64{0.001, 0.01, 0.1}, prometheus.ExponentialBuckets(1, 2, 20)...),
		},
		[]string{"request", "result"},
	)
)

Functions

func PublishAnnotationMetrics added in v1.23.0

func PublishAnnotationMetrics(annotationSize int, labelNumber int)

PublishAnnotationMetrics publishes collected metrics for endpoint annotations.

func PublishDegradedModeCorrectnessMetrics added in v1.24.0

func PublishDegradedModeCorrectnessMetrics(count int, endpointType string, negType string)

PublishDegradedModeCorrectnessMetrics publishes collected metrics of the correctness of degraded mode calculations compared with the current one

func PublishGCERequestCountMetrics added in v1.23.10

func PublishGCERequestCountMetrics(start time.Time, requestType string, err error)

PublishGCERequestCountMetrics publishes collected metrics for GCE Request Counts

func PublishK8sRequestCountMetrics added in v1.24.0

func PublishK8sRequestCountMetrics(start time.Time, requestType string, err error)

PublishK8sRequestCountMetrics publishes collected metrics for K8s Request Counts

func PublishLabelPropagationError added in v1.23.0

func PublishLabelPropagationError(errType string)

PublishLabelPropagationError publishes error occured during label propagation.

func PublishNegControllerErrorCountMetrics added in v1.24.0

func PublishNegControllerErrorCountMetrics(err error, isIgnored bool)

PublishNegControllerErrorCountMetrics publishes collected metrics for neg controller errors.

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()

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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