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

rest api: /debug/settings/pprof admin endpoint for debugging #6018

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

algorandskiy
Copy link
Contributor

@algorandskiy algorandskiy commented Jun 7, 2024

Note for reviewers

Most of this PR is autogenerated, actual changes are in these files:
daemon/algod/api/algod.oas2.json
daemon/algod/api/server/v2/handlers.go
daemon/algod/api/server/v2/test/handlers_test.go

Summary

A new PUT /debug/settings/pprof allows to control SetMutexProfileFraction and SetBlockProfileRate by passing non-negative rate values.

Test Plan

Added a unit test.
Run manual tests:

  1. It is indeed available only with admin token
  2. It produces non-empty profiles with
curl http://`cat ${ALGORAND_DATA}/algod.net`/debug/settings/pprof -H "X-Algo-API-Token: $(cat $ALGORAND_DATA/algod.token)"
{"message":"Invalid API Token"}

curl -XPUT http://`cat ${ALGORAND_DATA}/algod.net`/debug/settings/pprof -H "X-Algo-API-Token: $(cat $ALGORAND_DATA/algod.admin.token)" -d '{"block-rate":100,"mutex-rate":1}'
{"block-rate":0,"mutex-rate":0}

curl http://`cat ${ALGORAND_DATA}/algod.net`/debug/settings/pprof -H "X-Algo-API-Token: $(cat $ALGORAND_DATA/algod.admin.token)"
{"block-rate":100,"mutex-rate":1}

curl --silent -o algod.block.pprof http://`cat ${ALGORAND_DATA}/algod.net`/urlAuth/`cat ${ALGORAND_DATA}/algod.admin.token`/debug/pprof/block?seconds=20

curl --silent -o algod.mutex.pprof http://`cat ${ALGORAND_DATA}/algod.net`/urlAuth/`cat ${ALGORAND_DATA}/algod.admin.token`/debug/pprof/mutex?seconds=20

Mutex
image

Blocking
image

It allows to control SetMutexProfileFraction and SetBlockProfileRate
by passing non-negative rate values.
Copy link

codecov bot commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 0% with 37 lines in your changes missing coverage. Please review.

Project coverage is 55.89%. Comparing base (6c91f52) to head (51eff69).
Report is 21 commits behind head on master.

Current head 51eff69 differs from pull request most recent head 00c9e5d

Please upload reports for the commit 00c9e5d to get more accurate results.

Files Patch % Lines
daemon/algod/api/server/v2/handlers.go 0.00% 37 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6018      +/-   ##
==========================================
- Coverage   55.94%   55.89%   -0.06%     
==========================================
  Files         482      482              
  Lines       68310    68347      +37     
==========================================
- Hits        38219    38201      -18     
- Misses      27500    27551      +51     
- Partials     2591     2595       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

gmalouf
gmalouf previously approved these changes Jun 7, 2024
@algorandskiy algorandskiy changed the title rest api: /debug/extra/pprof admin endpoint for debugging rest api: /debug/settings/pprof admin endpoint for debugging Jun 7, 2024
@algorandskiy algorandskiy requested a review from gmalouf June 7, 2024 17:38
@algojohnlee algojohnlee merged commit f06a86e into algorand:master Jun 7, 2024
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants