metrics

package
v1.10.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CycleNodeRequests is the number of CycleNodeRequests in the cluster
	CycleNodeRequests = prometheus.NewDesc(
		fmt.Sprintf("%v_cycle_node_requests", namespace),
		"Number of CycleNodeRequests in the cluster",
		[]string{},
		nil,
	)
	// CycleNodeRequestsByPhase is the number of CycleNodeRequests in the cluster by phase
	CycleNodeRequestsByPhase = prometheus.NewDesc(
		fmt.Sprintf("%v_cycle_node_requests_by_phase", namespace),
		"Number of CycleNodeRequests in the cluster by phase for each nodegroup",
		[]string{"phase", "nodegroup"},
		nil,
	)
	// CycleNodeStatuses is the number of CycleNodeStatuses in the cluster
	CycleNodeStatuses = prometheus.NewDesc(
		fmt.Sprintf("%v_cycle_node_status", namespace),
		"Number of CycleNodeStatuses in the cluster",
		[]string{},
		nil,
	)
	// CycleNodeStatusesByPhase is the number of CycleNodeStatuses in the cluster by phase
	CycleNodeStatusesByPhase = prometheus.NewDesc(
		fmt.Sprintf("%v_cycle_node_status_by_phase", namespace),
		"Number of CycleNodeStatuses in the cluster by phase",
		[]string{"phase"},
		nil,
	)
	// NodeGroupInfo provides static information about nodegroups
	NodeGroupInfo = prometheus.NewDesc(
		fmt.Sprintf("%v_node_group_info", namespace),
		"Static information about nodegroups in the cluster",
		[]string{
			"nodegroup_name",
			"nodegroups_list",
			"node_selector",
			"concurrency",
			"method",
			"max_failed_cnrs",
			"skip_missing_named_nodes",
			"skip_initial_health_checks",
			"skip_pre_termination_checks",
			"priority",
		},
		nil,
	)
)
View Source
var (
	// AnnotationAddSuccess tracks successful annotation additions
	// Note: Using only nodegroup label to keep cardinality low (consistent with existing Cyclops metrics)
	AnnotationAddSuccess = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: fmt.Sprintf("%v_annotation_add_success_total", namespace),
			Help: "Total number of successful cluster-autoscaler scale-down-disabled annotation additions",
		},
		[]string{"nodegroup"},
	)

	// AnnotationAddFailure tracks failed annotation additions
	AnnotationAddFailure = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: fmt.Sprintf("%v_annotation_add_failure_total", namespace),
			Help: "Total number of failed cluster-autoscaler scale-down-disabled annotation additions",
		},
		[]string{"nodegroup", "error_type"},
	)

	// AnnotationRemoveSuccess tracks successful annotation removals
	AnnotationRemoveSuccess = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: fmt.Sprintf("%v_annotation_remove_success_total", namespace),
			Help: "Total number of successful cluster-autoscaler scale-down-disabled annotation removals",
		},
		[]string{"nodegroup"},
	)

	// AnnotationRemoveFailure tracks failed annotation removals
	AnnotationRemoveFailure = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: fmt.Sprintf("%v_annotation_remove_failure_total", namespace),
			Help: "Total number of failed cluster-autoscaler scale-down-disabled annotation removals",
		},
		[]string{"nodegroup", "error_type"},
	)

	// NodesWithAnnotation tracks current nodes with the annotation
	// Note: Includes node_name here because we need to track which specific nodes currently have the annotation
	// Cardinality is bounded by the number of nodes with annotations (typically small)
	NodesWithAnnotation = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: fmt.Sprintf("%v_nodes_with_scale_down_disabled_annotation", namespace),
			Help: "Current number of nodes with cluster-autoscaler scale-down-disabled annotation (1 = has annotation, 0 = does not have annotation)",
		},
		[]string{"nodegroup", "node_name"},
	)

	// AnnotationCleanupAttempts tracks cleanup operation attempts
	AnnotationCleanupAttempts = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: fmt.Sprintf("%v_annotation_cleanup_attempts_total", namespace),
			Help: "Total number of annotation cleanup attempts",
		},
		[]string{"nodegroup", "result"},
	)

	// AnnotationCleanupDuration tracks cleanup operation duration
	AnnotationCleanupDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    fmt.Sprintf("%v_annotation_cleanup_duration_seconds", namespace),
			Help:    "Duration of annotation cleanup operations in seconds",
			Buckets: prometheus.ExponentialBuckets(0.1, 2, 10),
		},
		[]string{"nodegroup"},
	)
)

Functions

func Register

func Register(client client.Client, logger logr.Logger, namespace string)

Register registers the custom metrics with prometheus

Types

This section is empty.

Jump to

Keyboard shortcuts

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