metrics: enable the metrics by command line only

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2023-09-13 12:30:17 +08:00
parent 641df0e39b
commit 3711a738bd
3 changed files with 1 additions and 11 deletions

View file

@ -257,12 +257,6 @@ func dumpConfig(ctx *cli.Context) error {
}
func applyMetricConfig(ctx *cli.Context, cfg *gethConfig) {
if ctx.IsSet(utils.MetricsEnabledFlag.Name) {
cfg.Metrics.Enabled = ctx.Bool(utils.MetricsEnabledFlag.Name)
}
if ctx.IsSet(utils.MetricsEnabledExpensiveFlag.Name) {
cfg.Metrics.EnabledExpensive = ctx.Bool(utils.MetricsEnabledExpensiveFlag.Name)
}
if ctx.IsSet(utils.MetricsHTTPFlag.Name) {
cfg.Metrics.HTTP = ctx.String(utils.MetricsHTTPFlag.Name)
}

View file

@ -2044,7 +2044,7 @@ func SetupMetrics(ctx *cli.Context) {
}
func SetupMetricsFromConfig(c *metrics.Config) {
if !c.Enabled {
if metrics.Enabled {
return
}

View file

@ -22,8 +22,6 @@ import (
// Config contains the configuration for the metric collection.
type Config struct {
Enabled bool `toml:",omitempty"`
EnabledExpensive bool `toml:",omitempty"`
HTTP string `toml:",omitempty"`
Port int `toml:",omitempty"`
EnableInfluxDB bool `toml:",omitempty"`
@ -54,8 +52,6 @@ func (c *Config) Validate() error {
// DefaultConfig is the default config for metrics used in go-ethereum.
var DefaultConfig = Config{
Enabled: false,
EnabledExpensive: false,
HTTP: "127.0.0.1",
Port: 6060,
EnableInfluxDB: false,