added manger to keep track of go routines in the services (#2869)

- added manager to wait for all go routines to end before exit
- code refactor
- renamed Manafer to Interface and GoRoutineManager to GroupManager
- replaced some go routine calls with manager Add func
- added unit tests for manager
This commit is contained in:
Vardhaman Surana
2023-11-07 15:30:48 +05:30
committed by GitHub
parent 27132975c4
commit 2a40b4538c
24 changed files with 283 additions and 67 deletions
+3 -2
View File
@@ -26,9 +26,10 @@ import (
"sigs.k8s.io/controller-runtime/pkg/metrics"
"github.com/fission/fission/pkg/utils/httpserver"
"github.com/fission/fission/pkg/utils/manager"
)
func ServeMetrics(ctx context.Context, parent string, logger *zap.Logger) {
func ServeMetrics(ctx context.Context, parent string, logger *zap.Logger, mgr manager.Interface) {
metricsAddr := os.Getenv("METRICS_ADDR")
if metricsAddr == "" {
metricsAddr = "8080"
@@ -45,5 +46,5 @@ func ServeMetrics(ctx context.Context, parent string, logger *zap.Logger) {
EnableOpenMetrics: true,
},
))
httpserver.StartServer(ctx, logger, parent+"/metrics", metricsAddr, mux)
httpserver.StartServer(ctx, logger, mgr, parent+"/metrics", metricsAddr, mux)
}