package apis import ( "net/http" "net/http/pprof" "github.com/felixge/fgprof" ) // ProfilerHandler func ProfilerHandler() http.Handler { mux := http.NewServeMux() mux.HandleFunc("/debug/pprof/", pprof.Index) mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline) mux.HandleFunc("/debug/pprof/profile", pprof.Profile) mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol) mux.HandleFunc("/debug/pprof/trace", pprof.Trace) // 性能监控 // https://github.com/thanos-io/thanos/blob/main/pkg/server/http/http.go#L118 mux.Handle("/debug/fgprof", fgprof.Handler()) return mux } // HealthyHandler Healthz 接口 func HealthzHandler(w http.ResponseWriter, r *http.Request) { w.Write([]byte("OK")) } // HealthyHandler 健康检查 func HealthyHandler(w http.ResponseWriter, r *http.Request) { w.Write([]byte("OK")) } // ReadyHandler 健康检查 func ReadyHandler(w http.ResponseWriter, r *http.Request) { w.Write([]byte("OK")) }