Extend the `debug/zip` API to other tools (Lightning, Dumpling, BR)
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Feature Request
**Is your feature request related to a problem? Please describe:**
The `debug/zip` HTTP endpoint is only available in TiDB (via #9651 at `http://[::]:10080/debug/zip`) and PD (via tikv/pd#4017 at `http://[::]:2379/debug/pprof/zip`).
In all other components (TiKV, BR/Lightning/Dumpling, DM/TiCDC, etc.) one can only retrieve the pprof one by one, which
1. this is very tedious
2. the profiles each require different set of parameters (`/profile` need `?seconds=N`, `/goroutine` need `?debug=2`) which is very error-prone, in particular with the non-CPU profiles accidentally adding `?seconds=N` will produce unusable garbage.
**Describe the feature you'd like:**
Bring the `debug/zip` API to all mentioned components (this issue is created for BR + Lightning + Dumpling in this repository only).
**Describe alternatives you've considered:**
Distribute a standardized script to fetch all the pprof.
```sh
#!/bin/sh
set -ex
ENDPOINT="$1"
SECONDS="$2"
OUTDIR="$3"
mkdir -p "$OUTDIR"
curl -o "$OUTDIR/goroutine" "$ENDPOINT/debug/pprof/goroutine?debug=2"
curl -o "$OUTDIR/heap" "$ENDPOINT/debug/pprof/heap?gc=1"
curl -o "$OUTDIR/mutex" "$ENDPOINT/debug/pprof/mutex"
curl -o "$OUTDIR/profile" "$ENDPOINT/debug/pprof/profile?seconds=$SECONDS"
```
This can only download the pprof profiles. The `debug/zip` output also contained the config and version, which may or may not be useful.
**Teachability, Documentation, Adoption, Migration Strategy:**
Note that TiDB's `/debug/zip` and PD's `/debug/pprof/zip` themselves are not yet documented anywhere in PingCAP's docs website. So these can be grouped together to introduce as a standardized debug interface for all PingCAP components. (Not sure about how to resolve the difference between TiDB and PD's URL)
Contributor guide
Assessment
This issue has not been assessed yet.