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

diagnostics: all pprofs #11891

Merged
merged 4 commits into from
Sep 6, 2024
Merged

diagnostics: all pprofs #11891

merged 4 commits into from
Sep 6, 2024

Conversation

dvovk
Copy link
Member

@dvovk dvovk commented Sep 5, 2024

Extended pprof read API to include: goroutine, threadcreate, heap, allocs, block, mutex

@dvovk dvovk modified the milestones: v2.60.7-fixes, 3.0.0-alpha4 Sep 5, 2024
@dvovk dvovk requested a review from taratorio September 5, 2024 19:32

//handle all pprof, supported: goroutine, threadcreate, heap, allocs, block, mutex
metricsMux.HandleFunc("/pprof/", func(w http.ResponseWriter, r *http.Request) {
profile := r.URL.Path[len("/pprof/"):]
Copy link
Member

Choose a reason for hiding this comment

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

You can use strings.TrimPrefix. Alternatively, you can also use HTTP params using r.URL.Query().Get("profile"), but this changes your request format to /pprof?profile=<name>.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

})
}

func writePproProfile(w http.ResponseWriter, profile string) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func writePproProfile(w http.ResponseWriter, profile string) {
func writeProfProfile(w http.ResponseWriter, profile string) {

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed typo, I want it to have "Pprof" to point that I and getting data from this lib

@dvovk dvovk requested a review from shohamc1 September 6, 2024 09:26
@dvovk dvovk merged commit a899646 into main Sep 6, 2024
10 checks passed
@dvovk dvovk deleted the diagpprof branch September 6, 2024 14:17
dvovk added a commit that referenced this pull request Sep 7, 2024
Extended pprof read API to include: goroutine, threadcreate, heap,
allocs, block, mutex
dvovk added a commit that referenced this pull request Sep 7, 2024
Extended pprof read API to include: goroutine, threadcreate, heap,
allocs, block, mutex
AskAlexSharov pushed a commit that referenced this pull request Sep 9, 2024
Extended pprof read API to include: goroutine, threadcreate, heap,
allocs, block, mutex
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