Executor: Dump function service cache for pool manager functions (#2789)

* dump function service cache for executor
* fix lint issue
* code refactor and lint fixes

---------

Signed-off-by: Shubham Bansal <shubhambansaliimtgn@gmail.com>
Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Shubham Bansal
2023-05-12 09:49:54 +05:30
committed by GitHub
co-authored by Sanket Sudake
parent 6c431e4d9b
commit f99f10134c
8 changed files with 120 additions and 0 deletions
@@ -35,6 +35,7 @@ import (
"github.com/fission/fission/pkg/crd"
ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/executor/metrics"
"github.com/fission/fission/pkg/executor/util"
)
type fscRequestType int
@@ -170,6 +171,27 @@ func (fsc *FunctionServiceCache) service() {
}
}
// DumpDebugInfo => dump function service cache data to temporary directory of executor pod.
func (fsc *FunctionServiceCache) DumpDebugInfo(ctx context.Context) error {
fsc.logger.Info("dumping function service")
file, err := util.CreateDumpFile(fsc.logger)
if err != nil {
fsc.logger.Error("error while creating file/dir", zap.String("error", err.Error()))
return err
}
defer file.Close()
err = fsc.connFunctionCache.LogFnSvcGroup(ctx, file)
if err != nil {
fsc.logger.Error("error while logging function service group", zap.String("error", err.Error()))
return err
}
fsc.logger.Info("dumped function service")
return nil
}
// GetByFunction gets a function service from cache using function key.
func (fsc *FunctionServiceCache) GetByFunction(m *metav1.ObjectMeta) (*FuncSvc, error) {
key := crd.CacheKey(m)