Fix Invocation count wrong for multiple namespace

Fixes https://github.com/openfaas/faas/issues/1413
Fixes https://github.com/openfaas/faas-netes/issues/707

This fixes the Gateway UI not updating the
invocation count automatically without a page reload.

Tested by deploying on a local cluster and making sure invocations go up
with and without namespace suffix

Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
This commit is contained in:
Alistair Hey
2020-11-11 20:39:17 +00:00
committed by Alex Ellis
parent 413f86ebc1
commit 7b6cc60bd9
3 changed files with 12 additions and 2 deletions

View File

@ -76,6 +76,7 @@ func AddMetricsHandler(handler http.HandlerFunc, prometheusQuery PrometheusQuery
}
func mixIn(functions *[]types.FunctionStatus, metrics *VectorQueryResponse) {
if functions == nil {
return
}
@ -92,7 +93,6 @@ func mixIn(functions *[]types.FunctionStatus, metrics *VectorQueryResponse) {
metricValue := v.Value[1]
switch metricValue.(type) {
case string:
// log.Println("String")
f, strconvErr := strconv.ParseFloat(metricValue.(string), 64)
if strconvErr != nil {
log.Printf("Unable to convert value for metric: %s\n", strconvErr)