Skip to content

Commit 0bec6a4

Browse files
authored
cmd/geth: enable metrics for geth import command (#20738)
* cmd/geth: enable metrics for geth import command * cmd/geth: enable metrics-flags for import command
1 parent f0b5eb0 commit 0bec6a4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cmd/geth/chaincmd.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
"github.com/ethereum/go-ethereum/eth/downloader"
3737
"github.com/ethereum/go-ethereum/event"
3838
"github.com/ethereum/go-ethereum/log"
39+
"github.com/ethereum/go-ethereum/metrics"
3940
"github.com/ethereum/go-ethereum/trie"
4041
"gopkg.in/urfave/cli.v1"
4142
)
@@ -82,6 +83,14 @@ The dumpgenesis command dumps the genesis block configuration in JSON format to
8283
utils.SnapshotFlag,
8384
utils.CacheDatabaseFlag,
8485
utils.CacheGCFlag,
86+
utils.MetricsEnabledFlag,
87+
utils.MetricsEnabledExpensiveFlag,
88+
utils.MetricsEnableInfluxDBFlag,
89+
utils.MetricsInfluxDBEndpointFlag,
90+
utils.MetricsInfluxDBDatabaseFlag,
91+
utils.MetricsInfluxDBUsernameFlag,
92+
utils.MetricsInfluxDBPasswordFlag,
93+
utils.MetricsInfluxDBTagsFlag,
8594
},
8695
Category: "BLOCKCHAIN COMMANDS",
8796
Description: `
@@ -255,6 +264,10 @@ func importChain(ctx *cli.Context) error {
255264
if len(ctx.Args()) < 1 {
256265
utils.Fatalf("This command requires an argument.")
257266
}
267+
// Start metrics export if enabled
268+
utils.SetupMetrics(ctx)
269+
// Start system runtime metrics collection
270+
go metrics.CollectProcessMetrics(3 * time.Second)
258271
stack := makeFullNode(ctx)
259272
defer stack.Close()
260273

0 commit comments

Comments
 (0)