feat: mount pprof and metrics to /api/v2/debug for admins (#20353)

Adds the following debug routes for people with the `debug_info:read`
permission:
- `/api/v2/debug/pprof` for `net/http/pprof`
    - `/`
    - `/cmdline`
    - `/profile`
    - `/symbol`
    - `/trace`
    - `/*`
- `/api/v2/debug/metrics` for Prometheus metrics
This commit is contained in:
Dean Sheather
2025-10-21 03:13:11 +00:00
committed by GitHub
parent 5a18cf4c86
commit 0652b18ebc
5 changed files with 348 additions and 3 deletions
+132
View File
@@ -954,6 +954,138 @@ const docTemplate = `{
}
}
},
"/debug/metrics": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"tags": [
"Debug"
],
"summary": "Debug metrics",
"operationId": "debug-metrics",
"responses": {
"200": {
"description": "OK"
}
},
"x-apidocgen": {
"skip": true
}
}
},
"/debug/pprof": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"tags": [
"Debug"
],
"summary": "Debug pprof index",
"operationId": "debug-pprof-index",
"responses": {
"200": {
"description": "OK"
}
},
"x-apidocgen": {
"skip": true
}
}
},
"/debug/pprof/cmdline": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"tags": [
"Debug"
],
"summary": "Debug pprof cmdline",
"operationId": "debug-pprof-cmdline",
"responses": {
"200": {
"description": "OK"
}
},
"x-apidocgen": {
"skip": true
}
}
},
"/debug/pprof/profile": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"tags": [
"Debug"
],
"summary": "Debug pprof profile",
"operationId": "debug-pprof-profile",
"responses": {
"200": {
"description": "OK"
}
},
"x-apidocgen": {
"skip": true
}
}
},
"/debug/pprof/symbol": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"tags": [
"Debug"
],
"summary": "Debug pprof symbol",
"operationId": "debug-pprof-symbol",
"responses": {
"200": {
"description": "OK"
}
},
"x-apidocgen": {
"skip": true
}
}
},
"/debug/pprof/trace": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"tags": [
"Debug"
],
"summary": "Debug pprof trace",
"operationId": "debug-pprof-trace",
"responses": {
"200": {
"description": "OK"
}
},
"x-apidocgen": {
"skip": true
}
}
},
"/debug/tailnet": {
"get": {
"security": [
+120
View File
@@ -840,6 +840,126 @@
}
}
},
"/debug/metrics": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"tags": ["Debug"],
"summary": "Debug metrics",
"operationId": "debug-metrics",
"responses": {
"200": {
"description": "OK"
}
},
"x-apidocgen": {
"skip": true
}
}
},
"/debug/pprof": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"tags": ["Debug"],
"summary": "Debug pprof index",
"operationId": "debug-pprof-index",
"responses": {
"200": {
"description": "OK"
}
},
"x-apidocgen": {
"skip": true
}
}
},
"/debug/pprof/cmdline": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"tags": ["Debug"],
"summary": "Debug pprof cmdline",
"operationId": "debug-pprof-cmdline",
"responses": {
"200": {
"description": "OK"
}
},
"x-apidocgen": {
"skip": true
}
}
},
"/debug/pprof/profile": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"tags": ["Debug"],
"summary": "Debug pprof profile",
"operationId": "debug-pprof-profile",
"responses": {
"200": {
"description": "OK"
}
},
"x-apidocgen": {
"skip": true
}
}
},
"/debug/pprof/symbol": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"tags": ["Debug"],
"summary": "Debug pprof symbol",
"operationId": "debug-pprof-symbol",
"responses": {
"200": {
"description": "OK"
}
},
"x-apidocgen": {
"skip": true
}
}
},
"/debug/pprof/trace": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"tags": ["Debug"],
"summary": "Debug pprof trace",
"operationId": "debug-pprof-trace",
"responses": {
"200": {
"description": "OK"
}
},
"x-apidocgen": {
"skip": true
}
}
},
"/debug/tailnet": {
"get": {
"security": [