fix: add go-eth metrics flags (#4269)

pull/4272/head
Diego Nava 2 years ago committed by GitHub
parent 3f8049f2b7
commit db870bddd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      cmd/harmony/flags.go

@ -233,6 +233,11 @@ var (
cacheTimeFlag, cacheTimeFlag,
cacheSizeFlag, cacheSizeFlag,
} }
metricsFlags = []cli.Flag{
metricsETHFlag,
metricsExpensiveETHFlag,
}
) )
var ( var (
@ -339,6 +344,7 @@ func getRootFlags() []cli.Flag {
flags = append(flags, prometheusFlags...) flags = append(flags, prometheusFlags...)
flags = append(flags, syncFlags...) flags = append(flags, syncFlags...)
flags = append(flags, shardDataFlags...) flags = append(flags, shardDataFlags...)
flags = append(flags, metricsFlags...)
return flags return flags
} }
@ -1754,6 +1760,22 @@ var (
} }
) )
// metrics flags required for the go-eth library
// https://github.com/ethereum/go-ethereum/blob/master/metrics/metrics.go#L35-L55
var (
metricsETHFlag = cli.BoolFlag{
Name: "metrics", // https://github.com/ethereum/go-ethereum/blob/master/metrics/metrics.go#L30
Usage: "flag required to enable the eth metrics",
DefValue: false,
}
metricsExpensiveETHFlag = cli.BoolFlag{
Name: "metrics.expensive", // https://github.com/ethereum/go-ethereum/blob/master/metrics/metrics.go#L33
Usage: "flag required to enable the expensive eth metrics",
DefValue: false,
}
)
func applyShardDataFlags(cmd *cobra.Command, cfg *harmonyconfig.HarmonyConfig) { func applyShardDataFlags(cmd *cobra.Command, cfg *harmonyconfig.HarmonyConfig) {
if cli.IsFlagChanged(cmd, enableShardDataFlag) { if cli.IsFlagChanged(cmd, enableShardDataFlag) {
cfg.ShardData.EnableShardData = cli.GetBoolFlagValue(cmd, enableShardDataFlag) cfg.ShardData.EnableShardData = cli.GetBoolFlagValue(cmd, enableShardDataFlag)

Loading…
Cancel
Save