mirror of
https://github.com/openfaas/faas.git
synced 2025-06-09 16:56:47 +00:00
Add logging to scale from zero requests
Trivial change to add logging around scale from zero events in scaling.go. Previously scale from zero events were not logged in the same way that normal scaling events are. This change adds log writes to show when a scale from zero was requested and when a function successfully moved to > 0 replicas. Signed-off-by: Richard Gee <richard@technologee.co.uk>
This commit is contained in:
parent
70a5e343c5
commit
7df548668f
@ -55,6 +55,9 @@ func MakeScalingHandler(next http.HandlerFunc, upstream http.HandlerFunc, config
|
||||
minReplicas = queryResponse.MinReplicas
|
||||
}
|
||||
|
||||
log.Printf("[Scale] function=%s 0 => %d requested", functionName, minReplicas)
|
||||
scalingStartTime := time.Now()
|
||||
|
||||
err := config.ServiceQuery.SetReplicas(functionName, minReplicas)
|
||||
if err != nil {
|
||||
errStr := fmt.Errorf("unable to scale function [%s], err: %s", functionName, err)
|
||||
@ -79,6 +82,8 @@ func MakeScalingHandler(next http.HandlerFunc, upstream http.HandlerFunc, config
|
||||
}
|
||||
|
||||
if queryResponse.AvailableReplicas > 0 {
|
||||
scalingDuration := time.Since(scalingStartTime)
|
||||
log.Printf("[Scale] function=%s 0 => %d successful - %f seconds", functionName, queryResponse.AvailableReplicas, scalingDuration.Seconds())
|
||||
break
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user