Use client generator to generate all k8s clients and add respective client-go metrics (#2668)

* Define client generator to generate all k8s clients
* Increase QPS and burst values
* Capture client-go metrics
* Support for controller runtime metrics

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2022-12-13 14:19:36 +05:30
committed by GitHub
parent 31f4f8c57e
commit 5fae765323
26 changed files with 252 additions and 137 deletions
+12 -4
View File
@@ -2,7 +2,8 @@ package router
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/fission/fission/pkg/utils/metrics"
)
var (
@@ -15,21 +16,21 @@ var (
// code: http status code
// path: the client call the function on which http path
// method: the function's http method
functionCalls = promauto.NewCounterVec(
functionCalls = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "fission_function_calls_total",
Help: "Count of Fission function calls",
},
labelsStrings,
)
functionCallErrors = promauto.NewCounterVec(
functionCallErrors = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "fission_function_errors_total",
Help: "Count of Fission function errors",
},
labelsStrings,
)
functionCallOverhead = promauto.NewSummaryVec(
functionCallOverhead = prometheus.NewSummaryVec(
prometheus.SummaryOpts{
Name: "fission_function_overhead_seconds",
Help: "The function call delay caused by fission.",
@@ -38,3 +39,10 @@ var (
labelsStrings,
)
)
func init() {
registry := metrics.Registry
registry.MustRegister(functionCalls)
registry.MustRegister(functionCallErrors)
registry.MustRegister(functionCallOverhead)
}
+7 -2
View File
@@ -90,9 +90,14 @@ func serve(ctx context.Context, logger *zap.Logger, port int,
func Start(ctx context.Context, logger *zap.Logger, port int, executorURL string) {
fmap := makeFunctionServiceMap(logger, time.Minute)
fissionClient, kubeClient, _, _, err := crd.MakeFissionClient()
clientGen := crd.NewClientGenerator()
fissionClient, err := clientGen.GetFissionClient()
if err != nil {
logger.Fatal("error connecting to kubernetes API", zap.Error(err))
logger.Fatal("error making the fission client", zap.Error(err))
}
kubeClient, err := clientGen.GetKubernetesClient()
if err != nil {
logger.Fatal("error making the kube client", zap.Error(err))
}
err = crd.WaitForCRDs(ctx, logger, fissionClient)