cmd/utils: remove deprecated command line flags (#22263)
This removes support for all deprecated flags except --rpc*.
This commit is contained in:
@ -90,30 +90,6 @@ var (
|
||||
Name: "trace",
|
||||
Usage: "Write execution trace to the given file",
|
||||
}
|
||||
// (Deprecated April 2020)
|
||||
legacyPprofPortFlag = cli.IntFlag{
|
||||
Name: "pprofport",
|
||||
Usage: "pprof HTTP server listening port (deprecated, use --pprof.port)",
|
||||
Value: 6060,
|
||||
}
|
||||
legacyPprofAddrFlag = cli.StringFlag{
|
||||
Name: "pprofaddr",
|
||||
Usage: "pprof HTTP server listening interface (deprecated, use --pprof.addr)",
|
||||
Value: "127.0.0.1",
|
||||
}
|
||||
legacyMemprofilerateFlag = cli.IntFlag{
|
||||
Name: "memprofilerate",
|
||||
Usage: "Turn on memory profiling with the given rate (deprecated, use --pprof.memprofilerate)",
|
||||
Value: runtime.MemProfileRate,
|
||||
}
|
||||
legacyBlockprofilerateFlag = cli.IntFlag{
|
||||
Name: "blockprofilerate",
|
||||
Usage: "Turn on block profiling with the given rate (deprecated, use --pprof.blockprofilerate)",
|
||||
}
|
||||
legacyCpuprofileFlag = cli.StringFlag{
|
||||
Name: "cpuprofile",
|
||||
Usage: "Write CPU profile to the given file (deprecated, use --pprof.cpuprofile)",
|
||||
}
|
||||
)
|
||||
|
||||
// Flags holds all command-line flags required for debugging.
|
||||
@ -123,12 +99,9 @@ var Flags = []cli.Flag{
|
||||
blockprofilerateFlag, cpuprofileFlag, traceFlag,
|
||||
}
|
||||
|
||||
var DeprecatedFlags = []cli.Flag{
|
||||
legacyPprofPortFlag, legacyPprofAddrFlag, legacyMemprofilerateFlag,
|
||||
legacyBlockprofilerateFlag, legacyCpuprofileFlag,
|
||||
}
|
||||
|
||||
var glogger *log.GlogHandler
|
||||
var (
|
||||
glogger *log.GlogHandler
|
||||
)
|
||||
|
||||
func init() {
|
||||
glogger = log.NewGlogHandler(log.StreamHandler(os.Stderr, log.TerminalFormat(false)))
|
||||
@ -159,16 +132,8 @@ func Setup(ctx *cli.Context) error {
|
||||
log.Root().SetHandler(glogger)
|
||||
|
||||
// profiling, tracing
|
||||
if ctx.GlobalIsSet(legacyMemprofilerateFlag.Name) {
|
||||
runtime.MemProfileRate = ctx.GlobalInt(legacyMemprofilerateFlag.Name)
|
||||
log.Warn("The flag --memprofilerate is deprecated and will be removed in the future, please use --pprof.memprofilerate")
|
||||
}
|
||||
runtime.MemProfileRate = ctx.GlobalInt(memprofilerateFlag.Name)
|
||||
|
||||
if ctx.GlobalIsSet(legacyBlockprofilerateFlag.Name) {
|
||||
Handler.SetBlockProfileRate(ctx.GlobalInt(legacyBlockprofilerateFlag.Name))
|
||||
log.Warn("The flag --blockprofilerate is deprecated and will be removed in the future, please use --pprof.blockprofilerate")
|
||||
}
|
||||
Handler.SetBlockProfileRate(ctx.GlobalInt(blockprofilerateFlag.Name))
|
||||
|
||||
if traceFile := ctx.GlobalString(traceFlag.Name); traceFile != "" {
|
||||
@ -182,26 +147,12 @@ func Setup(ctx *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if cpuFile := ctx.GlobalString(legacyCpuprofileFlag.Name); cpuFile != "" {
|
||||
log.Warn("The flag --cpuprofile is deprecated and will be removed in the future, please use --pprof.cpuprofile")
|
||||
if err := Handler.StartCPUProfile(cpuFile); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// pprof server
|
||||
if ctx.GlobalBool(pprofFlag.Name) {
|
||||
listenHost := ctx.GlobalString(pprofAddrFlag.Name)
|
||||
if ctx.GlobalIsSet(legacyPprofAddrFlag.Name) && !ctx.GlobalIsSet(pprofAddrFlag.Name) {
|
||||
listenHost = ctx.GlobalString(legacyPprofAddrFlag.Name)
|
||||
log.Warn("The flag --pprofaddr is deprecated and will be removed in the future, please use --pprof.addr")
|
||||
}
|
||||
|
||||
port := ctx.GlobalInt(pprofPortFlag.Name)
|
||||
if ctx.GlobalIsSet(legacyPprofPortFlag.Name) && !ctx.GlobalIsSet(pprofPortFlag.Name) {
|
||||
port = ctx.GlobalInt(legacyPprofPortFlag.Name)
|
||||
log.Warn("The flag --pprofport is deprecated and will be removed in the future, please use --pprof.port")
|
||||
}
|
||||
|
||||
address := fmt.Sprintf("%s:%d", listenHost, port)
|
||||
// This context value ("metrics.addr") represents the utils.MetricsHTTPFlag.Name.
|
||||
|
Reference in New Issue
Block a user