From 909e7b9314799bfb9b81bc66295ebbe5b427aa5a Mon Sep 17 00:00:00 2001 From: Eric <45141191+zzphust@users.noreply.github.com> Date: Wed, 2 Aug 2023 14:06:24 +0800 Subject: [PATCH] metrics: add txpool config into metrics server (#1788) --- cmd/geth/config.go | 1 + cmd/utils/flags.go | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/cmd/geth/config.go b/cmd/geth/config.go index 0f01f123e8..05d5e19887 100644 --- a/cmd/geth/config.go +++ b/cmd/geth/config.go @@ -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 } diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 9064b21d8a..167b9f7a51 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -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")