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
+14
View File
@@ -263,6 +263,19 @@ func (executor *Executor) unTapService(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
// dumpDebugInfo => dump function service for pool cache
func (executor *Executor) dumpDebugInfo(w http.ResponseWriter, r *http.Request) {
// currently we are considering dumping function only for pool manager
et := executor.executorTypes[fv1.ExecutorTypePoolmgr]
if err := et.DumpDebugInfo(r.Context()); err != nil {
code, msg := ferror.GetHTTPError(err)
http.Error(w, msg, code)
return
}
w.WriteHeader(http.StatusOK)
}
// GetHandler returns an http.Handler.
func (executor *Executor) GetHandler() http.Handler {
r := mux.NewRouter()
@@ -272,6 +285,7 @@ func (executor *Executor) GetHandler() http.Handler {
r.HandleFunc("/v2/tapServices", executor.tapServices).Methods("POST")
r.HandleFunc("/healthz", executor.healthHandler).Methods("GET")
r.HandleFunc("/v2/unTapService", executor.unTapService).Methods("POST")
r.HandleFunc("/v2/debugInfo", executor.dumpDebugInfo).Methods("GET")
return r
}