Skip to content

Commit 5c03b96

Browse files
committed
Add metric that is emitted after a successful single run of static
autoscaler. This will allow to detect situations where loop starts and not ends (because of a health check for example). Note that existing loop start metric is not enough because if we have autoscaler killed another autoscaler will take over role of the leader and again emit the metric of the main starting.
1 parent 50f2483 commit 5c03b96

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

cluster-autoscaler/loop/run.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ func RunAutoscalerOnce(autoscaler autoscaler, healthCheck *metrics.HealthCheck,
3737
if err != nil && err.Type() != errors.TransientError {
3838
metrics.RegisterError(err)
3939
} else {
40-
healthCheck.UpdateLastSuccessfulRun(time.Now())
40+
var successTime = time.Now()
41+
healthCheck.UpdateLastSuccessfulRun(successTime)
42+
metrics.UpdateLastTime(metrics.MainSuccessful, successTime)
4143
}
4244

4345
metrics.UpdateDurationFromStart(metrics.Main, loopStart)

cluster-autoscaler/metrics/metrics.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const (
110110
FilterOutSchedulable FunctionLabel = "filterOutSchedulable"
111111
CloudProviderRefresh FunctionLabel = "cloudProviderRefresh"
112112
Main FunctionLabel = "main"
113+
MainSuccessful FunctionLabel = "mainSuccessful"
113114
Poll FunctionLabel = "poll"
114115
Reconfigure FunctionLabel = "reconfigure"
115116
Autoscaling FunctionLabel = "autoscaling"

0 commit comments

Comments
 (0)