Skip to content

Commit

Permalink
rest api: /debug/settings/pprof admin endpoint for debugging (algoran…
Browse files Browse the repository at this point in the history
  • Loading branch information
algorandskiy authored Jun 7, 2024
1 parent 9853ab2 commit f06a86e
Show file tree
Hide file tree
Showing 12 changed files with 1,718 additions and 1,361 deletions.
64 changes: 64 additions & 0 deletions daemon/algod/api/algod.oas2.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,44 @@
}
}
},
"/debug/settings/pprof": {
"get": {
"description": "Retrieves the current settings for blocking and mutex profiles",
"tags": [
"private"
],
"produces": [
"application/json"
],
"schemes": [
"http"
],
"operationId": "GetDebugSettingsProf",
"responses": {
"200": {
"$ref": "#/responses/DebugSettingsProfResponse"
}
}
},
"put": {
"description": "Enables blocking and mutex profiles, and returns the old settings",
"tags": [
"private"
],
"produces": [
"application/json"
],
"schemes": [
"http"
],
"operationId": "PutDebugSettingsProf",
"responses": {
"200": {
"$ref": "#/responses/DebugSettingsProfResponse"
}
}
}
},
"/v2/accounts/{address}": {
"get": {
"description": "Given a specific account public key, this call returns the accounts status, balance and spendable amounts",
Expand Down Expand Up @@ -4053,6 +4091,26 @@
}
}
},
"DebugSettingsProf": {
"description": "algod mutex and blocking profiling state.",
"type": "object",
"title": "algod mutex and blocking profiling state.",
"tags": [
"private"
],
"properties": {
"block-rate": {
"description": "The rate of blocking events. The profiler aims to sample an average of one blocking event per rate nanoseconds spent blocked. To turn off profiling entirely, pass rate 0.",
"example": 1000,
"type": "integer"
},
"mutex-rate": {
"description": "The rate of mutex events. On average 1/rate events are reported. To turn off profiling entirely, pass rate 0",
"example": 1000,
"type": "integer"
}
}
},
"BuildVersion": {
"tags": [
"common"
Expand Down Expand Up @@ -5500,6 +5558,12 @@
"schema": {
"$ref": "#/definitions/Version"
}
},
"DebugSettingsProfResponse": {
"description": "DebugPprof is the response to the /debug/extra/pprof endpoint",
"schema": {
"$ref": "#/definitions/DebugSettingsProf"
}
}
},
"securityDefinitions": {
Expand Down
67 changes: 67 additions & 0 deletions daemon/algod/api/algod.oas3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,16 @@
},
"description": "Teal compile Result"
},
"DebugSettingsProfResponse": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DebugSettingsProf"
}
}
},
"description": "DebugPprof is the response to the /debug/extra/pprof endpoint"
},
"DisassembleResponse": {
"content": {
"application/json": {
Expand Down Expand Up @@ -1790,6 +1800,23 @@
"title": "BuildVersion contains the current algod build version information.",
"type": "object"
},
"DebugSettingsProf": {
"description": "algod mutex and blocking profiling state.",
"properties": {
"block-rate": {
"description": "The rate of blocking events. The profiler aims to sample an average of one blocking event per rate nanoseconds spent blocked. To turn off profiling entirely, pass rate 0.",
"example": 1000,
"type": "integer"
},
"mutex-rate": {
"description": "The rate of mutex events. On average 1/rate events are reported. To turn off profiling entirely, pass rate 0",
"example": 1000,
"type": "integer"
}
},
"title": "algod mutex and blocking profiling state.",
"type": "object"
},
"DryrunRequest": {
"description": "Request data type for dryrun endpoint. Given the Transactions and simulated ledger state upload, run TEAL scripts and return debugging information.",
"properties": {
Expand Down Expand Up @@ -2748,6 +2775,46 @@
},
"openapi": "3.0.1",
"paths": {
"/debug/settings/pprof": {
"get": {
"description": "Retrieves the current settings for blocking and mutex profiles",
"operationId": "GetDebugSettingsProf",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DebugSettingsProf"
}
}
},
"description": "DebugPprof is the response to the /debug/extra/pprof endpoint"
}
},
"tags": [
"private"
]
},
"put": {
"description": "Enables blocking and mutex profiles, and returns the old settings",
"operationId": "PutDebugSettingsProf",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DebugSettingsProf"
}
}
},
"description": "DebugPprof is the response to the /debug/extra/pprof endpoint"
}
},
"tags": [
"private"
]
}
},
"/genesis": {
"get": {
"description": "Returns the entire genesis file in json.",
Expand Down
2 changes: 0 additions & 2 deletions daemon/algod/api/server/common/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ func VersionsHandler(ctx lib.ReqContext, context echo.Context) {
},
}
json.NewEncoder(w).Encode(response.Body)

return
}

// CORS
Expand Down
Loading

0 comments on commit f06a86e

Please sign in to comment.