mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
fix: enable state size tracker if metrics and flag are enabled
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
6f7c81ff71
commit
1472040dc4
5 changed files with 11 additions and 13 deletions
|
|
@ -375,9 +375,6 @@ func applyMetricConfig(ctx *cli.Context, cfg *gethConfig) {
|
||||||
if ctx.IsSet(utils.MetricsInfluxDBOrganizationFlag.Name) {
|
if ctx.IsSet(utils.MetricsInfluxDBOrganizationFlag.Name) {
|
||||||
cfg.Metrics.InfluxDBOrganization = ctx.String(utils.MetricsInfluxDBOrganizationFlag.Name)
|
cfg.Metrics.InfluxDBOrganization = ctx.String(utils.MetricsInfluxDBOrganizationFlag.Name)
|
||||||
}
|
}
|
||||||
if ctx.IsSet(utils.MetricsStateSizeFlag.Name) {
|
|
||||||
cfg.Metrics.EnableStateSizeTracking = ctx.Bool(utils.MetricsStateSizeFlag.Name)
|
|
||||||
}
|
|
||||||
// Sanity-check the commandline flags. It is fine if some unused fields is part
|
// Sanity-check the commandline flags. It is fine if some unused fields is part
|
||||||
// of the toml-config, but we expect the commandline to only contain relevant
|
// of the toml-config, but we expect the commandline to only contain relevant
|
||||||
// arguments, otherwise it indicates an error.
|
// arguments, otherwise it indicates an error.
|
||||||
|
|
|
||||||
|
|
@ -970,7 +970,7 @@ Please note that --` + MetricsHTTPFlag.Name + ` must be set to start the server.
|
||||||
MetricsStateSizeFlag = &cli.BoolFlag{
|
MetricsStateSizeFlag = &cli.BoolFlag{
|
||||||
Name: "metrics.statesize",
|
Name: "metrics.statesize",
|
||||||
Usage: "Enable state size tracking for metrics collection",
|
Usage: "Enable state size tracking for metrics collection",
|
||||||
Value: metrics.DefaultConfig.EnableStateSizeTracking,
|
Value: ethconfig.Defaults.EnableStateSizeTracking,
|
||||||
Category: flags.MetricsCategory,
|
Category: flags.MetricsCategory,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -1733,6 +1733,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
||||||
cfg.EthDiscoveryURLs = SplitAndTrim(urls)
|
cfg.EthDiscoveryURLs = SplitAndTrim(urls)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ctx.Bool(MetricsEnabledFlag.Name) && ctx.Bool(MetricsStateSizeFlag.Name) {
|
||||||
|
log.Error("Enabling state size metrics")
|
||||||
|
cfg.EnableStateSizeTracking = true
|
||||||
|
}
|
||||||
// Override any default configs for hard coded networks.
|
// Override any default configs for hard coded networks.
|
||||||
switch {
|
switch {
|
||||||
case ctx.Bool(MainnetFlag.Name):
|
case ctx.Bool(MainnetFlag.Name):
|
||||||
|
|
@ -2225,10 +2230,6 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
|
||||||
} else if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheSnapshotFlag.Name) {
|
} else if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheSnapshotFlag.Name) {
|
||||||
options.SnapshotLimit = ctx.Int(CacheFlag.Name) * ctx.Int(CacheSnapshotFlag.Name) / 100
|
options.SnapshotLimit = ctx.Int(CacheFlag.Name) * ctx.Int(CacheSnapshotFlag.Name) / 100
|
||||||
}
|
}
|
||||||
if ctx.Bool(MetricsStateSizeFlag.Name) {
|
|
||||||
log.Info("Enabling state size tracking")
|
|
||||||
options.EnableStateSizeTracking = true
|
|
||||||
}
|
|
||||||
// If we're in readonly, do not bother generating snapshot data.
|
// If we're in readonly, do not bother generating snapshot data.
|
||||||
if readonly {
|
if readonly {
|
||||||
options.SnapshotNoBuild = true
|
options.SnapshotNoBuild = true
|
||||||
|
|
|
||||||
|
|
@ -241,6 +241,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
// - DATADIR/triedb/merkle.journal
|
// - DATADIR/triedb/merkle.journal
|
||||||
// - DATADIR/triedb/verkle.journal
|
// - DATADIR/triedb/verkle.journal
|
||||||
TrieJournalDirectory: stack.ResolvePath("triedb"),
|
TrieJournalDirectory: stack.ResolvePath("triedb"),
|
||||||
|
EnableStateSizeTracking: config.EnableStateSizeTracking,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
if config.VMTrace != "" {
|
if config.VMTrace != "" {
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,9 @@ type Config struct {
|
||||||
// Enables tracking of SHA3 preimages in the VM
|
// Enables tracking of SHA3 preimages in the VM
|
||||||
EnablePreimageRecording bool
|
EnablePreimageRecording bool
|
||||||
|
|
||||||
|
// Enables tracking of state size
|
||||||
|
EnableStateSizeTracking bool
|
||||||
|
|
||||||
// Enables VM tracing
|
// Enables VM tracing
|
||||||
VMTrace string
|
VMTrace string
|
||||||
VMTraceJsonConfig string
|
VMTraceJsonConfig string
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,6 @@ type Config struct {
|
||||||
InfluxDBToken string `toml:",omitempty"`
|
InfluxDBToken string `toml:",omitempty"`
|
||||||
InfluxDBBucket string `toml:",omitempty"`
|
InfluxDBBucket string `toml:",omitempty"`
|
||||||
InfluxDBOrganization string `toml:",omitempty"`
|
InfluxDBOrganization string `toml:",omitempty"`
|
||||||
|
|
||||||
EnableStateSizeTracking bool `toml:",omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultConfig is the default config for metrics used in go-ethereum.
|
// DefaultConfig is the default config for metrics used in go-ethereum.
|
||||||
|
|
@ -55,6 +53,4 @@ var DefaultConfig = Config{
|
||||||
InfluxDBToken: "test",
|
InfluxDBToken: "test",
|
||||||
InfluxDBBucket: "geth",
|
InfluxDBBucket: "geth",
|
||||||
InfluxDBOrganization: "geth",
|
InfluxDBOrganization: "geth",
|
||||||
|
|
||||||
EnableStateSizeTracking: false,
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue