metrics

package
v1.10.5 Latest Latest
Warning

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

Go to latest
Published: May 18, 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"},
	)

	// NodeCleanupAnnotationsRemoved tracks how many stale annotations the node
	// controller has removed. A non-zero rate means the normal CNR lifecycle
	// failed to clean up after itself.
	NodeCleanupAnnotationsRemoved = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: fmt.Sprintf("%v_node_cleanup_annotations_removed_total", namespace),
			Help: "Total number of stale scale-down-disabled annotations removed by the node controller",
		},
	)

	// NodeCleanupReconciles tracks reconcile outcomes for the node controller.
	// Labels:
	//   result: "cleaned"              – stale annotations were removed
	//           "active_cnr_skipped"   – node is covered by an active CNR, left alone
	//           "no_nodegroup_skipped" – node is not selected by any NodeGroup, left alone
	//           "error"                – reconcile failed with an error
	NodeCleanupReconciles = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: fmt.Sprintf("%v_node_cleanup_reconciles_total", namespace),
			Help: "Total number of node controller cleanup reconcile outcomes",
		},
		[]string{"result"},
	)
)

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