mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
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:
@@ -61,7 +61,6 @@ go_library(
|
||||
"//monitoring/prometheus:go_default_library",
|
||||
"//monitoring/tracing:go_default_library",
|
||||
"//runtime:go_default_library",
|
||||
"//runtime/debug:go_default_library",
|
||||
"//runtime/prereqs:go_default_library",
|
||||
"//runtime/version:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//common:go_default_library",
|
||||
|
||||
@@ -64,7 +64,6 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v5/encoding/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/v5/monitoring/prometheus"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/debug"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/prereqs"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/version"
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -432,7 +431,6 @@ func (b *BeaconNode) Start() {
|
||||
defer signal.Stop(sigc)
|
||||
<-sigc
|
||||
log.Info("Got interrupt, shutting down...")
|
||||
debug.Exit(b.cliCtx) // Ensure trace and CPU profile data are flushed.
|
||||
go b.Close()
|
||||
for i := 10; i > 0; i-- {
|
||||
<-sigc
|
||||
|
||||
3
changelog/james-prysm_deprecate-non-pprof.md
Normal file
3
changelog/james-prysm_deprecate-non-pprof.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Deprecated
|
||||
|
||||
- deprecates and removes usage of the `--trace` flag and`--cpuprofile` flag in favor of just using `--pprof`
|
||||
@@ -211,6 +211,8 @@ var appHelpFlagGroups = []flagGroup{
|
||||
Name: "deprecated",
|
||||
Flags: []cli.Flag{
|
||||
cmd.BackupWebhookOutputDir,
|
||||
debug.CPUProfileFlag,
|
||||
debug.TraceFlag,
|
||||
},
|
||||
},
|
||||
{ // Flags used in debugging Prysm. These are flags not usually run by end users.
|
||||
@@ -218,13 +220,11 @@ var appHelpFlagGroups = []flagGroup{
|
||||
Flags: []cli.Flag{
|
||||
cmd.MaxGoroutines,
|
||||
debug.BlockProfileRateFlag,
|
||||
debug.CPUProfileFlag,
|
||||
debug.MemProfileRateFlag,
|
||||
debug.MutexProfileFractionFlag,
|
||||
debug.PProfAddrFlag,
|
||||
debug.PProfFlag,
|
||||
debug.PProfPortFlag,
|
||||
debug.TraceFlag,
|
||||
flags.SetGCPercent,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -199,10 +199,6 @@ func main() {
|
||||
|
||||
return cmd.ValidateNoArgs(ctx)
|
||||
},
|
||||
After: func(ctx *cli.Context) error {
|
||||
debug.Exit(ctx)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
defer func() {
|
||||
|
||||
@@ -85,8 +85,6 @@ var appHelpFlagGroups = []flagGroup{
|
||||
debug.PProfAddrFlag,
|
||||
debug.PProfPortFlag,
|
||||
debug.MemProfileRateFlag,
|
||||
debug.CPUProfileFlag,
|
||||
debug.TraceFlag,
|
||||
debug.BlockProfileRateFlag,
|
||||
debug.MutexProfileFractionFlag,
|
||||
},
|
||||
@@ -157,6 +155,13 @@ var appHelpFlagGroups = []flagGroup{
|
||||
flags.InteropStartIndex,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "deprecated",
|
||||
Flags: []cli.Flag{
|
||||
debug.CPUProfileFlag,
|
||||
debug.TraceFlag,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ go_library(
|
||||
"//monitoring/prometheus:go_default_library",
|
||||
"//monitoring/tracing:go_default_library",
|
||||
"//runtime:go_default_library",
|
||||
"//runtime/debug:go_default_library",
|
||||
"//runtime/prereqs:go_default_library",
|
||||
"//runtime/version:go_default_library",
|
||||
"//validator/accounts/wallet:go_default_library",
|
||||
|
||||
@@ -32,7 +32,6 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v5/monitoring/prometheus"
|
||||
"github.com/prysmaticlabs/prysm/v5/monitoring/tracing"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/debug"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/prereqs"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/version"
|
||||
"github.com/prysmaticlabs/prysm/v5/validator/accounts/wallet"
|
||||
@@ -154,7 +153,6 @@ func (c *ValidatorClient) Start() {
|
||||
defer signal.Stop(sigc)
|
||||
<-sigc
|
||||
log.Info("Got interrupt, shutting down...")
|
||||
debug.Exit(c.cliCtx) // Ensure trace and CPU profile data are flushed.
|
||||
go c.Close()
|
||||
for i := 10; i > 0; i-- {
|
||||
<-sigc
|
||||
|
||||
Reference in New Issue
Block a user