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

cmd/thanos/main.go: simplify pprof registration #1671

Merged
merged 1 commit into from
Oct 21, 2019

Conversation

squat
Copy link
Member

@squat squat commented Oct 21, 2019

This commit simplifies the registration of pprof HTTP endpoints. The
pprof.Index handler automatically takes care of delegating to the
correct handler for each profile depending on the request path:
https://golang.org/src/net/http/pprof/pprof.go?s=8862:9042#L260
The following profiles are handled:
https://golang.org/src/net/http/pprof/pprof.go?s=7565:8570#L248
Note that this also includes the allocs profile, which was previously
not explicitly added.

Signed-off-by: Lucas Servén Marín [email protected]

Verification

Built binary and verified all pprof endpoints continue to function.

cc @bwplotka

This commit simplifies the registration of pprof HTTP endpoints. The
pprof.Index handler automatically takes care of delegating to the
correct handler for each profile depending on the request path:
https://golang.org/src/net/http/pprof/pprof.go?s=8862:9042#L260
The following profiles are handled:
https://golang.org/src/net/http/pprof/pprof.go?s=7565:8570#L248
Note that this also includes the `allocs` profile, which was previously
not explicitly added.

Signed-off-by: Lucas Servén Marín <[email protected]>
@@ -236,10 +236,6 @@ func registerProfile(mux *http.ServeMux) {
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so those are not added by index?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack, only the profiles accessible via pprof.Handler(...) are delegated.

@bwplotka bwplotka merged commit 2f88fca into thanos-io:master Oct 21, 2019
GiedriusS pushed a commit that referenced this pull request Oct 28, 2019
This commit simplifies the registration of pprof HTTP endpoints. The
pprof.Index handler automatically takes care of delegating to the
correct handler for each profile depending on the request path:
https://golang.org/src/net/http/pprof/pprof.go?s=8862:9042#L260
The following profiles are handled:
https://golang.org/src/net/http/pprof/pprof.go?s=7565:8570#L248
Note that this also includes the `allocs` profile, which was previously
not explicitly added.

Signed-off-by: Lucas Servén Marín <[email protected]>
Signed-off-by: Giedrius Statkevičius <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants