Skip to content

Commit

Permalink
metrics: add txpool config into metrics server (#1788)
Browse files Browse the repository at this point in the history
  • Loading branch information
zlacfzy committed Aug 2, 2023
1 parent 54b4e58 commit 909e7b9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
utils.SetupMetrics(ctx,
utils.EnableBuildInfo(gitCommit, gitDate),
utils.EnableMinerInfo(ctx, cfg.Eth.Miner),
utils.EnableNodeInfo(cfg.Eth.TxPool),
)
return stack, backend
}
Expand Down
15 changes: 15 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -1972,6 +1972,21 @@ func EnableMinerInfo(ctx *cli.Context, minerConfig miner.Config) SetupMetricsOpt
}
}

func EnableNodeInfo(poolConfig core.TxPoolConfig) SetupMetricsOption {
return func() {
// register node info into metrics
metrics.NewRegisteredLabel("node-info", nil).Mark(map[string]interface{}{
"PriceLimit": poolConfig.PriceLimit,
"PriceBump": poolConfig.PriceBump,
"AccountSlots": poolConfig.AccountSlots,
"GlobalSlots": poolConfig.GlobalSlots,
"AccountQueue": poolConfig.AccountQueue,
"GlobalQueue": poolConfig.GlobalQueue,
"Lifetime": poolConfig.Lifetime,
})
}
}

func SetupMetrics(ctx *cli.Context, options ...SetupMetricsOption) {
if metrics.Enabled {
log.Info("Enabling metrics collection")
Expand Down

0 comments on commit 909e7b9

Please sign in to comment.