From db870bddd8f1a99fa4eae7fac5eb12680063955e Mon Sep 17 00:00:00 2001 From: Diego Nava <8563843+diego1q2w@users.noreply.github.com> Date: Wed, 24 Aug 2022 03:34:57 +0200 Subject: [PATCH] fix: add go-eth metrics flags (#4269) --- cmd/harmony/flags.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cmd/harmony/flags.go b/cmd/harmony/flags.go index ade66df63..dd9a49929 100644 --- a/cmd/harmony/flags.go +++ b/cmd/harmony/flags.go @@ -233,6 +233,11 @@ var ( cacheTimeFlag, cacheSizeFlag, } + + metricsFlags = []cli.Flag{ + metricsETHFlag, + metricsExpensiveETHFlag, + } ) var ( @@ -339,6 +344,7 @@ func getRootFlags() []cli.Flag { flags = append(flags, prometheusFlags...) flags = append(flags, syncFlags...) flags = append(flags, shardDataFlags...) + flags = append(flags, metricsFlags...) 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) { if cli.IsFlagChanged(cmd, enableShardDataFlag) { cfg.ShardData.EnableShardData = cli.GetBoolFlagValue(cmd, enableShardDataFlag)