open-match icon indicating copy to clipboard operation
open-match copied to clipboard

zpages pprof seems to be unaccessable due to router problem

Open liuqianhong6007 opened this issue 1 year ago • 0 comments

func bindZpages(p Params, b Bindings) error {
	if !p.Config().GetBool(configNameTelemetryZpagesEnabled) {
		logger.Info("zPages: Disabled")
		return nil
	}
	logger.WithFields(logrus.Fields{
		"endpoint": debugEndpoint,
	}).Info("zPages: ENABLED")

	mux := http.NewServeMux()

	zpages.Handle(mux, debugEndpoint)

	mux.HandleFunc(debugEndpoint+"/pprof/", pprof.Index)
	mux.HandleFunc(debugEndpoint+"/pprof/cmdline", pprof.Cmdline)
	mux.HandleFunc(debugEndpoint+"/pprof/profile", pprof.Profile)
	mux.HandleFunc(debugEndpoint+"/pprof/symbol", pprof.Symbol)
	mux.HandleFunc(debugEndpoint+"/pprof/trace", pprof.Trace)

	b.TelemetryHandle(debugEndpoint, mux)

	return nil
}

When http.ServerMux is as the handler of another ServerMux, the top path expect a / in the end of path. So b.TelemetryHandle(debugEndpoint, mux) should be b.TelemetryHandle(debugEndpoint+"/", mux)

liuqianhong6007 avatar Aug 03 '23 10:08 liuqianhong6007