Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal/debug: remove deprecated flags #23368

Merged
merged 3 commits into from Sep 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
68 changes: 1 addition & 67 deletions internal/debug/flags.go
Expand Up @@ -90,39 +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)",
}
legacyBacktraceAtFlag = cli.StringFlag{
Name: "backtrace",
Usage: "Request a stack trace at a specific logging statement (e.g. \"block.go:271\") (deprecated, use --log.backtrace)",
Value: "",
}
legacyDebugFlag = cli.BoolFlag{
Name: "debug",
Usage: "Prepends log messages with call-site location (file and line number) (deprecated, use --log.debug)",
}
)

// Flags holds all command-line flags required for debugging.
Expand All @@ -141,17 +108,6 @@ var Flags = []cli.Flag{
traceFlag,
}

// This is the list of deprecated debugging flags.
var DeprecatedFlags = []cli.Flag{
legacyPprofPortFlag,
legacyPprofAddrFlag,
legacyMemprofilerateFlag,
legacyBlockprofilerateFlag,
legacyCpuprofileFlag,
legacyBacktraceAtFlag,
legacyDebugFlag,
}

var glogger *log.GlogHandler

func init() {
Expand Down Expand Up @@ -183,45 +139,23 @@ func Setup(ctx *cli.Context) error {
glogger.Vmodule(vmodule)

debug := ctx.GlobalBool(debugFlag.Name)
if ctx.GlobalIsSet(legacyDebugFlag.Name) {
debug = ctx.GlobalBool(legacyDebugFlag.Name)
log.Warn("The flag --debug is deprecated and will be removed in the future, please use --log.debug")
}
if ctx.GlobalIsSet(debugFlag.Name) {
debug = ctx.GlobalBool(debugFlag.Name)
}
log.PrintOrigins(debug)

backtrace := ctx.GlobalString(backtraceAtFlag.Name)
if b := ctx.GlobalString(legacyBacktraceAtFlag.Name); b != "" {
backtrace = b
log.Warn("The flag --backtrace is deprecated and will be removed in the future, please use --log.backtrace")
}
if b := ctx.GlobalString(backtraceAtFlag.Name); b != "" {
backtrace = b
}
glogger.BacktraceAt(backtrace)

log.Root().SetHandler(glogger)

// profiling, tracing
runtime.MemProfileRate = memprofilerateFlag.Value
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")
}
if ctx.GlobalIsSet(memprofilerateFlag.Name) {
holiman marked this conversation as resolved.
Show resolved Hide resolved
runtime.MemProfileRate = ctx.GlobalInt(memprofilerateFlag.Name)
}

blockProfileRate := blockprofilerateFlag.Value
if ctx.GlobalIsSet(legacyBlockprofilerateFlag.Name) {
blockProfileRate = ctx.GlobalInt(legacyBlockprofilerateFlag.Name)
log.Warn("The flag --blockprofilerate is deprecated and will be removed in the future, please use --pprof.blockprofilerate")
}
if ctx.GlobalIsSet(blockprofilerateFlag.Name) {
blockProfileRate = ctx.GlobalInt(blockprofilerateFlag.Name)
}
blockProfileRate := ctx.GlobalInt(blockprofilerateFlag.Name)
Handler.SetBlockProfileRate(blockProfileRate)

if traceFile := ctx.GlobalString(traceFlag.Name); traceFile != "" {
Expand Down