Skip to content

Commit

Permalink
rest api: /debug/extra/pprof admin endpoint for debugging
Browse files Browse the repository at this point in the history
It allows to control SetMutexProfileFraction and SetBlockProfileRate
by passing non-negative rate values.
  • Loading branch information
algorandskiy committed Jun 7, 2024
1 parent 6c91f52 commit c1bbdad
Show file tree
Hide file tree
Showing 12 changed files with 1,719 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 @@ -1305,6 +1305,44 @@
}
]
},
"/debug/extra/pprof": {
"get": {
"description": "Retrieves the current settings for blocking and mutex profiles",
"tags": [
"private"
],
"produces": [
"application/json"
],
"schemes": [
"http"
],
"operationId": "GetDebugExtraProf",
"responses": {
"200": {
"$ref": "#/responses/DebugExtraProfResponse"
}
}
},
"put": {
"description": "Enables blocking and mutex profiles, and returns the old settings",
"tags": [
"private"
],
"produces": [
"application/json"
],
"schemes": [
"http"
],
"operationId": "PutDebugExtraProf",
"responses": {
"200": {
"$ref": "#/responses/DebugExtraProfResponse"
}
}
}
},
"/v2/shutdown": {
"post": {
"description": "Special management endpoint to shutdown the node. Optionally provide a timeout parameter to indicate that the node should begin shutting down after a number of seconds.",
Expand Down Expand Up @@ -4053,6 +4091,26 @@
}
}
},
"DebugExtraProf": {
"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"
}
},
"DebugExtraProfResponse": {
"description": "DebugPprof is the response to the /debug/extra/pprof endpoint",
"schema": {
"$ref": "#/definitions/DebugExtraProf"
}
}
},
"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"
},
"DebugExtraProfResponse": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DebugExtraProf"
}
}
},
"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"
},
"DebugExtraProf": {
"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/extra/pprof": {
"get": {
"description": "Retrieves the current settings for blocking and mutex profiles",
"operationId": "GetDebugExtraProf",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DebugExtraProf"
}
}
},
"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": "PutDebugExtraProf",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DebugExtraProf"
}
}
},
"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 c1bbdad

Please sign in to comment.