Repository: rclone/rclone
File: fs/rc/rc.go (Go)

Code before:
	Name:    "rc_web_gui",
	Default: false,
	Help:    "Launch WebGUI on localhost",
	Groups:  "RC",
}, {
	Name:    "rc_web_gui_update",
	Default: false,
	Help:    "Check and update to latest version of web gui",
	Groups:  "RC",
}, {
	Name:    "rc_web_gui_force_update",
	Default: false,
	Help:    "Force update to latest version of web gui",
	Groups:  "RC",
}, {
	Name:    "rc_web_gui_no_open_browser",
	Default: false,
	Help:    "Don't open the browser automatically",
	Groups:  "RC",
}, {
	Name:    "rc_web_fetch_url",
	Default: "https://api.github.com/repos/rclone/rclone-webui-react/releases/latest",
	Help:    "URL to fetch the releases for webgui",
	Groups:  "RC",
}, {
	Name:    "metrics",
	Default: false,
	Help:    "Enable the prometheus metrics endpoint",
	Groups:  "Metrics",
}, {
	Name:    "rc_job_expire_duration",
	Default: 60 * time.Second,
	Help:    "Expire finished async jobs older than this value",
	Groups:  "RC",
}, {
	Name:    "rc_job_expire_interval",
	Default: 10 * time.Second,
	Help:    "Interval to check for expired async jobs",
	Groups:  "RC",
}}.
	AddPrefix(libhttp.ConfigInfo, "rc", "RC").
	AddPrefix(libhttp.AuthConfigInfo, "rc", "RC").
	AddPrefix(libhttp.TemplateConfigInfo, "rc", "RC").
	AddPrefix(libhttp.ConfigInfo, "metrics", "Metrics").
	AddPrefix(libhttp.AuthConfigInfo, "metrics", "Metrics").
	AddPrefix(libhttp.TemplateConfigInfo, "metrics", "Metrics").
	SetDefault("rc_addr", []string{"localhost:5572"}).
	SetDefault("metrics_addr", []string{"localhost:5572"})

func init() {
	fs.RegisterGlobalOptions(fs.OptionsInfo{Name: "rc", Opt: &Opt, Options: OptionsInfo})

Review comment (refactor):
We can't remove this flag as we break backwards compatibility.

I would suggest the new metrics are enabled only if the user supplies `--metrics-addr`

Code after:
	Name:    "rc_web_gui",
	Default: false,
	Help:    "Launch WebGUI on localhost",
	Groups:  "RC",
}, {
	Name:    "rc_web_gui_update",
	Default: false,
	Help:    "Check and update to latest version of web gui",
	Groups:  "RC",
}, {
	Name:    "rc_web_gui_force_update",
	Default: false,
	Help:    "Force update to latest version of web gui",
	Groups:  "RC",
}, {
	Name:    "rc_web_gui_no_open_browser",
	Default: false,
	Help:    "Don't open the browser automatically",
	Groups:  "RC",
}, {
	Name:    "rc_web_fetch_url",
	Default: "https://api.github.com/repos/rclone/rclone-webui-react/releases/latest",
	Help:    "URL to fetch the releases for webgui",
	Groups:  "RC",
}, {
	Name:    "rc_enable_metrics",
	Default: false,
	Help:    "Enable the Prometheus metrics path at the remote control server",
	Groups:  "RC,Metrics",
}, {
	Name:    "rc_job_expire_duration",
	Default: 60 * time.Second,
	Help:    "Expire finished async jobs older than this value",
	Groups:  "RC",
}, {
	Name:    "rc_job_expire_interval",
	Default: 10 * time.Second,
	Help:    "Interval to check for expired async jobs",
	Groups:  "RC",
}, {
	Name:    "metrics_addr",
	Default: []string{""},
	Help:    "IPaddress:Port or :Port to bind metrics server to",
	Groups:  "Metrics",
}}.
	AddPrefix(libhttp.ConfigInfo, "rc", "RC").
	AddPrefix(libhttp.AuthConfigInfo, "rc", "RC").
	AddPrefix(libhttp.TemplateConfigInfo, "rc", "RC").
	AddPrefix(libhttp.ConfigInfo, "metrics", "Metrics").
	AddPrefix(libhttp.AuthConfigInfo, "metrics", "Metrics").
	AddPrefix(libhttp.TemplateConfigInfo, "metrics", "Metrics").