Skip to content

Commit

Permalink
Merge pull request #6604 from dsafdsa1/export-metrics
Browse files Browse the repository at this point in the history
Track auto-provisioned queued provisioning node groups.
  • Loading branch information
k8s-ci-robot authored Mar 14, 2024
2 parents 65db534 + 61fa2a0 commit e85934c
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions cluster-autoscaler/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,20 +390,22 @@ var (
},
)

nodeGroupCreationCount = k8smetrics.NewCounter(
nodeGroupCreationCount = k8smetrics.NewCounterVec(
&k8smetrics.CounterOpts{
Namespace: caNamespace,
Name: "created_node_groups_total",
Help: "Number of node groups created by Node Autoprovisioning.",
},
[]string{"group_type"},
)

nodeGroupDeletionCount = k8smetrics.NewCounter(
nodeGroupDeletionCount = k8smetrics.NewCounterVec(
&k8smetrics.CounterOpts{
Namespace: caNamespace,
Name: "deleted_node_groups_total",
Help: "Number of node groups deleted by Node Autoprovisioning.",
},
[]string{"group_type"},
)

nodeTaintsCount = k8smetrics.NewGaugeVec(
Expand Down Expand Up @@ -643,12 +645,22 @@ func UpdateNapEnabled(enabled bool) {

// RegisterNodeGroupCreation registers node group creation
func RegisterNodeGroupCreation() {
nodeGroupCreationCount.Add(1.0)
RegisterNodeGroupCreationWithLabelValues("")
}

// RegisterNodeGroupCreationWithLabelValues registers node group creation with the provided labels
func RegisterNodeGroupCreationWithLabelValues(groupType string) {
nodeGroupCreationCount.WithLabelValues(groupType).Add(1.0)
}

// RegisterNodeGroupDeletion registers node group deletion
func RegisterNodeGroupDeletion() {
nodeGroupDeletionCount.Add(1.0)
RegisterNodeGroupDeletionWithLabelValues("")
}

// RegisterNodeGroupDeletionWithLabelValues registers node group deletion with the provided labels
func RegisterNodeGroupDeletionWithLabelValues(groupType string) {
nodeGroupDeletionCount.WithLabelValues(groupType).Add(1.0)
}

// UpdateScaleDownInCooldown registers if the cluster autoscaler
Expand Down

0 comments on commit e85934c

Please sign in to comment.