Skip to content

Commit e85934c

Browse files
authored
Merge pull request #6604 from dsafdsa1/export-metrics
Track auto-provisioned queued provisioning node groups.
2 parents 65db534 + 61fa2a0 commit e85934c

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

cluster-autoscaler/metrics/metrics.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,20 +390,22 @@ var (
390390
},
391391
)
392392

393-
nodeGroupCreationCount = k8smetrics.NewCounter(
393+
nodeGroupCreationCount = k8smetrics.NewCounterVec(
394394
&k8smetrics.CounterOpts{
395395
Namespace: caNamespace,
396396
Name: "created_node_groups_total",
397397
Help: "Number of node groups created by Node Autoprovisioning.",
398398
},
399+
[]string{"group_type"},
399400
)
400401

401-
nodeGroupDeletionCount = k8smetrics.NewCounter(
402+
nodeGroupDeletionCount = k8smetrics.NewCounterVec(
402403
&k8smetrics.CounterOpts{
403404
Namespace: caNamespace,
404405
Name: "deleted_node_groups_total",
405406
Help: "Number of node groups deleted by Node Autoprovisioning.",
406407
},
408+
[]string{"group_type"},
407409
)
408410

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

644646
// RegisterNodeGroupCreation registers node group creation
645647
func RegisterNodeGroupCreation() {
646-
nodeGroupCreationCount.Add(1.0)
648+
RegisterNodeGroupCreationWithLabelValues("")
649+
}
650+
651+
// RegisterNodeGroupCreationWithLabelValues registers node group creation with the provided labels
652+
func RegisterNodeGroupCreationWithLabelValues(groupType string) {
653+
nodeGroupCreationCount.WithLabelValues(groupType).Add(1.0)
647654
}
648655

649656
// RegisterNodeGroupDeletion registers node group deletion
650657
func RegisterNodeGroupDeletion() {
651-
nodeGroupDeletionCount.Add(1.0)
658+
RegisterNodeGroupDeletionWithLabelValues("")
659+
}
660+
661+
// RegisterNodeGroupDeletionWithLabelValues registers node group deletion with the provided labels
662+
func RegisterNodeGroupDeletionWithLabelValues(groupType string) {
663+
nodeGroupDeletionCount.WithLabelValues(groupType).Add(1.0)
652664
}
653665

654666
// UpdateScaleDownInCooldown registers if the cluster autoscaler

0 commit comments

Comments
 (0)