mirror of
https://github.com/openfaas/faas.git
synced 2025-06-09 16:56:47 +00:00
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:
parent
413f86ebc1
commit
7b6cc60bd9
@ -124,7 +124,7 @@
|
|||||||
|
|
||||||
<md-input-container class="md-block" flex-gt-sm>
|
<md-input-container class="md-block" flex-gt-sm>
|
||||||
<label>Invocation count</label>
|
<label>Invocation count</label>
|
||||||
<input ng-model="function.invocationCount" type="text" readonly="readonly">
|
<input value="{{ function.invocationCount }}" type="text" readonly="readonly">
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
|
|
||||||
<md-input-container class="md-block" flex-gt-sm ng-show="allNamespaces.length > 1">
|
<md-input-container class="md-block" flex-gt-sm ng-show="allNamespaces.length > 1">
|
||||||
|
10
gateway/assets/script/bootstrap.js
vendored
10
gateway/assets/script/bootstrap.js
vendored
@ -222,6 +222,16 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$interval', '$f
|
|||||||
$scope.selectedFunction = undefined;
|
$scope.selectedFunction = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($scope.selectedFunction) {
|
||||||
|
response.data.some(function(entry) {
|
||||||
|
if (entry.name === $scope.selectedFunction.name) {
|
||||||
|
$scope.selectedFunction.invocationCount = entry.invocationCount
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -76,6 +76,7 @@ func AddMetricsHandler(handler http.HandlerFunc, prometheusQuery PrometheusQuery
|
|||||||
}
|
}
|
||||||
|
|
||||||
func mixIn(functions *[]types.FunctionStatus, metrics *VectorQueryResponse) {
|
func mixIn(functions *[]types.FunctionStatus, metrics *VectorQueryResponse) {
|
||||||
|
|
||||||
if functions == nil {
|
if functions == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -92,7 +93,6 @@ func mixIn(functions *[]types.FunctionStatus, metrics *VectorQueryResponse) {
|
|||||||
metricValue := v.Value[1]
|
metricValue := v.Value[1]
|
||||||
switch metricValue.(type) {
|
switch metricValue.(type) {
|
||||||
case string:
|
case string:
|
||||||
// log.Println("String")
|
|
||||||
f, strconvErr := strconv.ParseFloat(metricValue.(string), 64)
|
f, strconvErr := strconv.ParseFloat(metricValue.(string), 64)
|
||||||
if strconvErr != nil {
|
if strconvErr != nil {
|
||||||
log.Printf("Unable to convert value for metric: %s\n", strconvErr)
|
log.Printf("Unable to convert value for metric: %s\n", strconvErr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user