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

api: add pprof zip api #4017

Merged
merged 16 commits into from
Aug 27, 2021
Merged

api: add pprof zip api #4017

merged 16 commits into from
Aug 27, 2021

Conversation

bufferflies
Copy link
Contributor

@bufferflies bufferflies commented Aug 20, 2021

What problem does this PR solve?

relate: #4013

What is changed and how it works?

put pprof ,goroutine ,mutex,allocs,config,version to zip file

image

Check List

Tests

  • Manual test (add detailed scripts or steps below)

Code changes

Side effects

Related changes

  • Need to cherry-pick to the release branch

Release note

add debug/zip http api to zip file that debug needed

Signed-off-by: bufferflies <1045931706@qq.com>
Signed-off-by: bufferflies <1045931706@qq.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 20, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • disksing
  • nolouch

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Aug 20, 2021
Signed-off-by: bufferflies <1045931706@qq.com>
@bufferflies bufferflies changed the title Feature/pprof all api: add pprof zip api Aug 20, 2021
Signed-off-by: bufferflies <1045931706@qq.com>
@codecov
Copy link

codecov bot commented Aug 20, 2021

Codecov Report

Merging #4017 (addbf3e) into master (f4c20c9) will decrease coverage by 0.01%.
The diff coverage is 54.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4017      +/-   ##
==========================================
- Coverage   74.47%   74.45%   -0.02%     
==========================================
  Files         256      257       +1     
  Lines       25877    25948      +71     
==========================================
+ Hits        19272    19320      +48     
- Misses       4882     4894      +12     
- Partials     1723     1734      +11     
Flag Coverage Δ
unittests 74.45% <54.92%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
server/api/version.go 100.00% <ø> (ø)
server/api/pprof.go 54.28% <54.28%> (ø)
server/api/router.go 97.22% <100.00%> (+0.01%) ⬆️
pkg/tempurl/tempurl.go 45.00% <0.00%> (-15.00%) ⬇️
server/schedule/operator/step.go 68.10% <0.00%> (-1.67%) ⬇️
server/grpc_service.go 47.45% <0.00%> (-0.23%) ⬇️
client/client.go 71.82% <0.00%> (+0.13%) ⬆️
server/tso/allocator_manager.go 67.27% <0.00%> (+0.16%) ⬆️
server/cluster/cluster.go 82.58% <0.00%> (+0.35%) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f4c20c9...addbf3e. Read the comment docs.

Copy link
Contributor

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

lgtm

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 20, 2021
Signed-off-by: bufferflies <1045931706@qq.com>
Signed-off-by: bufferflies <1045931706@qq.com>
server/api/router.go Outdated Show resolved Hide resolved
server/api/router.go Outdated Show resolved Hide resolved
Signed-off-by: bufferflies <1045931706@qq.com>
Signed-off-by: bufferflies <1045931706@qq.com>
server/api/pprof.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Aug 23, 2021
// @Produce application/octet-stream
// @Router /pprof/debug/zip [get]
func (h *ProfHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Disposition", fmt.Sprintf(`attachment; filename="pd_debug"`+time.Now().Format("20060102_150405")+".zip"))
Copy link
Member

Choose a reason for hiding this comment

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

The format is a little bit different with TiDB.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it will be better to splite date and time

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can let tidb with the new format.

server/api/pprof.go Outdated Show resolved Hide resolved
bufferflies and others added 2 commits August 23, 2021 14:11
Signed-off-by: bufferflies <1045931706@qq.com>
@nolouch
Copy link
Contributor

nolouch commented Aug 27, 2021

/merge

@ti-chi-bot
Copy link
Member

@nolouch: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: bba56e0

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 27, 2021
@nolouch
Copy link
Contributor

nolouch commented Aug 27, 2021

/test

@ti-chi-bot ti-chi-bot merged commit c328f3a into tikv:master Aug 27, 2021
v01dstar pushed a commit to v01dstar/pd that referenced this pull request Oct 28, 2021
* add debug zip

Signed-off-by: bufferflies <1045931706@qq.com>

* change zip name and  time format

Signed-off-by: bufferflies <1045931706@qq.com>

* import、annotation、log

Signed-off-by: bufferflies <1045931706@qq.com>

* pass ut

Signed-off-by: bufferflies <1045931706@qq.com>

* add unit test

Signed-off-by: bufferflies <1045931706@qq.com>

* pass ut

Signed-off-by: bufferflies <1045931706@qq.com>

* refine api route

Signed-off-by: bufferflies <1045931706@qq.com>

* pass ut

Signed-off-by: bufferflies <1045931706@qq.com>

* remove new prof handler

Signed-off-by: bufferflies <1045931706@qq.com>

* code lint

Signed-off-by: bufferflies <1045931706@qq.com>

Co-authored-by: ShuNing <nolouch@gmail.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
@bufferflies bufferflies deleted the feature/pprofAll branch February 17, 2022 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note Denotes a PR that will be considered when it comes time to generate release notes. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants