From 3a070941525d2c8aeee4371d19ad86c6dc1a5d4d Mon Sep 17 00:00:00 2001 From: Calvin Leung Huang Date: Mon, 7 Oct 2019 08:55:17 -0700 Subject: [PATCH] docs: add sys/pprof API docs (#7562) * docs: add sys/pprof api docs * fix header --- website/data/api_detailed_categories.yml | 1 + website/source/api/system/pprof.html.md | 142 +++++++++++++++++++++++ website/source/layouts/api.erb | 1 + 3 files changed, 144 insertions(+) create mode 100644 website/source/api/system/pprof.html.md diff --git a/website/data/api_detailed_categories.yml b/website/data/api_detailed_categories.yml index 5de9cf522d..1b1d87e64e 100644 --- a/website/data/api_detailed_categories.yml +++ b/website/data/api_detailed_categories.yml @@ -72,6 +72,7 @@ - api/system/plugins-catalog.html - api/system/policy.html - api/system/policies.html + - api/system/pprof.html - api/system/raw.html - api/system/rekey.html - api/system/rekey-recovery-key.html diff --git a/website/source/api/system/pprof.html.md b/website/source/api/system/pprof.html.md new file mode 100644 index 0000000000..0191590fe5 --- /dev/null +++ b/website/source/api/system/pprof.html.md @@ -0,0 +1,142 @@ +--- +layout: "api" +page_title: "/sys/pprof - HTTP API" +sidebar_title: "/sys/pprof" +sidebar_current: "api-http-system-pprof" +description: |- + The `/sys/pprof` endpoint is used to query profiling information. +--- + +# `/sys/pprof` + +The `/sys/pprof` endpoint is used to query. The response returned by +these endpoints are equivalent to those returned by the `http/pprof` +package. + +## Index + +This endpoint returns an HTML page listing the available profiles. + +| Method | Path | +|:-------|:--------------| +| `GET` | `/sys/pprof/` | + +### Sample Request + +``` +$ curl \ + --header "X-Vault-Token: ..." \ + http://127.0.0.1:8200/v1/sys/pprof/ +``` + +## Cmdline + +This endpoint returns the running program's command line, with arguments +separated by NUL bytes. + +| Method | Path | +|:-------|:---------------------| +| `GET` | `/sys/pprof/cmdline` | + +### Sample Request + +``` +$ curl \ + --header "X-Vault-Token: ..." \ + http://127.0.0.1:8200/v1/sys/pprof/cmdline +``` + +## Goroutine + +This endpoint returns stack traces of all current goroutines. + +| Method | Path | +|:-------|:-----------------------| +| `GET` | `/sys/pprof/goroutine` | + +### Sample Request + +``` +$ curl \ + --header "X-Vault-Token: ..." \ + http://127.0.0.1:8200/v1/sys/pprof/goroutine +``` + +## Heap + +This endpoint returns a sampling of memory allocations of live object. + +| Method | Path | +|:-------|:------------------| +| `GET` | `/sys/pprof/heap` | + +### Sample Request + +``` +$ curl \ + --header "X-Vault-Token: ..." \ + http://127.0.0.1:8200/v1/sys/pprof/heap +``` + +## Profile + +This endpoint returns a pprof-formatted cpu profile payload. Profiling +lasts for duration specified in seconds GET parameter, or for 30 seconds +if not specified. + +| Method | Path | +|:-------|:---------------------| +| `GET` | `/sys/pprof/profile` | + +### Parameters + +- `seconds` `(int: 30)` - Specifies the duration to run the profiling + command. This value is specified as a query parameter. + +### Sample Request + +``` +$ curl \ + --header "X-Vault-Token: ..." \ + http://127.0.0.1:8200/v1/sys/pprof/profile +``` + +## Symbol + +This endpoint returns the program counters listed in the request. + +| Method | Path | +|:-------|:--------------------| +| `GET` | `/sys/pprof/symbol` | + +### Sample Request + +``` +$ curl \ + --header "X-Vault-Token: ..." \ + http://127.0.0.1:8200/v1/sys/pprof/symbol +``` + + +## Trace + +This endpoint returns the execution trace in binary form. Tracing lasts +for duration specified in seconds GET parameter, or for 1 second if not +specified. + +| Method | Path | +|:-------|:-------------------| +| `GET` | `/sys/pprof/trace` | + +### Parameters + +- `seconds` `(int: 1)` - Specifies the duration to run the tracing + command. This value is specified as a query parameter. + +### Sample Request + +``` +$ curl \ + --header "X-Vault-Token: ..." \ + http://127.0.0.1:8200/v1/sys/pprof/trace +``` \ No newline at end of file diff --git a/website/source/layouts/api.erb b/website/source/layouts/api.erb index 6ad40f51a0..df8625e931 100644 --- a/website/source/layouts/api.erb +++ b/website/source/layouts/api.erb @@ -126,6 +126,7 @@ 'plugins-catalog', 'policy', 'policies', + 'pprof', 'raw', 'rekey', 'rekey-recovery-key',