Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zpages pprof seems to be unaccessable due to router problem #1583

Open
liuqianhong6007 opened this issue Aug 3, 2023 · 0 comments
Open

zpages pprof seems to be unaccessable due to router problem #1583

liuqianhong6007 opened this issue Aug 3, 2023 · 0 comments
Labels
kind/bug Something isn't working

Comments

@liuqianhong6007
Copy link

liuqianhong6007 commented Aug 3, 2023

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 liuqianhong6007 added the kind/bug Something isn't working label Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant