Deprecate broken and unused debug flags in favor of --pprof (#15083)

* deprecating the trace and cpuprofile flags in favor of pprof

* gaz

* fixing change log title

* added hidden tags
This commit is contained in:
james-prysm
2025-03-24 14:30:32 -05:00
committed by GitHub
parent 2b4d8a09ff
commit e08ed0d823
9 changed files with 20 additions and 46 deletions

View File

@@ -78,15 +78,17 @@ var (
Name: "blockprofilerate",
Usage: "Turns on block profiling with the given rate.",
}
// CPUProfileFlag to specify where to write the CPU profile.
// deprecated: CPUProfileFlag
CPUProfileFlag = &cli.StringFlag{
Name: "cpuprofile",
Usage: "Writes CPU profile to the given file.",
Name: "cpuprofile",
Hidden: true,
Usage: "Do not use, deprecated",
}
// TraceFlag to specify where to write the trace execution profile.
// deprecated: TraceFlag
TraceFlag = &cli.StringFlag{
Name: "trace",
Usage: "Writes execution trace to the given file.",
Name: "trace",
Hidden: true,
Usage: "Do not use, deprecated",
}
)
@@ -328,17 +330,6 @@ func Setup(ctx *cli.Context) error {
if ctx.IsSet(MutexProfileFractionFlag.Name) {
runtime.SetMutexProfileFraction(ctx.Int(MutexProfileFractionFlag.Name))
}
if traceFile := ctx.String(TraceFlag.Name); traceFile != "" {
if err := Handler.StartGoTrace(TraceFlag.Name); err != nil {
return err
}
}
if cpuFile := ctx.String(CPUProfileFlag.Name); cpuFile != "" {
if err := Handler.StartCPUProfile(cpuFile); err != nil {
return err
}
}
// pprof server
if ctx.Bool(PProfFlag.Name) {
address := fmt.Sprintf("%s:%d", ctx.String(PProfAddrFlag.Name), ctx.Int(PProfPortFlag.Name))
@@ -359,18 +350,3 @@ func startPProf(address string) {
}
}()
}
// Exit stops all running profiles, flushing their output to the
// respective file.
func Exit(ctx *cli.Context) {
if traceFile := ctx.String(TraceFlag.Name); traceFile != "" {
if err := Handler.StopGoTrace(); err != nil {
log.WithError(err).Error("Failed to stop go tracing")
}
}
if cpuFile := ctx.String(CPUProfileFlag.Name); cpuFile != "" {
if err := Handler.StopCPUProfile(); err != nil {
log.WithError(err).Error("Failed to stop CPU profiling")
}
}
}