Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
arch_suffix: -amd64
uses: NethermindEth/github-workflows/.github/workflows/docker-build-push-jfrog.yaml@v1.9.2
with:
ignore_trivy: true
run_trivy: false
group_name: core
runner: ${{ matrix.runner }}
image_name: 'arbitrum-nitro'
Expand Down
27 changes: 27 additions & 0 deletions cmd/genericconf/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,24 @@ var PProfDefault = PProf{
Port: 6071,
}

type PrometheusPushgatewayConfig struct {
Enabled bool `koanf:"enabled"`
URL string `koanf:"url"`
JobName string `koanf:"job-name"`
Prefix string `koanf:"prefix"`
Instance string `koanf:"instance"`
UpdateInterval time.Duration `koanf:"update-interval"`
}

var PrometheusPushgatewayConfigDefault = PrometheusPushgatewayConfig{
Enabled: false,
URL: "http://127.0.0.1:9091/metrics",
JobName: "arbitrum-nitro",
Prefix: "",
Instance: "",
UpdateInterval: 5 * time.Second,
}

func MetricsServerAddOptions(prefix string, f *flag.FlagSet) {
f.String(prefix+".addr", MetricsServerConfigDefault.Addr, "metrics server address")
f.Int(prefix+".port", MetricsServerConfigDefault.Port, "metrics server port")
Expand All @@ -219,3 +237,12 @@ func PProfAddOptions(prefix string, f *flag.FlagSet) {
f.String(prefix+".addr", PProfDefault.Addr, "pprof server address")
f.Int(prefix+".port", PProfDefault.Port, "pprof server port")
}

func PrometheusPushgatewayAddOptions(prefix string, f *flag.FlagSet) {
f.Bool(prefix+".enabled", PrometheusPushgatewayConfigDefault.Enabled, "enable prometheus pushgateway")
f.String(prefix+".url", PrometheusPushgatewayConfigDefault.URL, "prometheus push gateway URL (should include /metrics path if needed)")
f.String(prefix+".job-name", PrometheusPushgatewayConfigDefault.JobName, "prometheus push gateway job name")
f.String(prefix+".prefix", PrometheusPushgatewayConfigDefault.Prefix, "metric name prefix to avoid collisions")
f.String(prefix+".instance", PrometheusPushgatewayConfigDefault.Instance, "instance label to distinguish multiple nodes")
f.Duration(prefix+".update-interval", PrometheusPushgatewayConfigDefault.UpdateInterval, "prometheus push gateway update interval")
}
79 changes: 52 additions & 27 deletions cmd/nitro/nitro.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ import (
"time"

"github.com/cockroachdb/pebble"
"github.com/ethereum/go-ethereum/metrics"
"github.com/knadh/koanf"
"github.com/knadh/koanf/providers/confmap"
flag "github.com/spf13/pflag"
"github.com/syndtr/goleveldb/leveldb"

"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/keystore"
Expand All @@ -39,8 +45,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/params"
"github.com/knadh/koanf"
"github.com/knadh/koanf/providers/confmap"

"github.com/offchainlabs/nitro/arbnode"
"github.com/offchainlabs/nitro/arbnode/resourcemanager"
"github.com/offchainlabs/nitro/arbutil"
Expand Down Expand Up @@ -69,8 +74,6 @@ import (
"github.com/offchainlabs/nitro/util/signature"
"github.com/offchainlabs/nitro/validator/server_common"
"github.com/offchainlabs/nitro/validator/valnode"
flag "github.com/spf13/pflag"
"github.com/syndtr/goleveldb/leveldb"
)

func printSampleUsage(name string) {
Expand Down Expand Up @@ -453,6 +456,25 @@ func mainImpl() int {
return 1
}

if nodeConfig.PrometheusPushgateway.Enabled {
stopPusher := nethexec.StartPrometheusPusher(
ctx,
nodeConfig.PrometheusPushgateway.URL,
nodeConfig.PrometheusPushgateway.JobName,
nodeConfig.PrometheusPushgateway.Prefix,
nodeConfig.PrometheusPushgateway.Instance,
nodeConfig.PrometheusPushgateway.UpdateInterval,
metrics.DefaultRegistry,
)
deferFuncs = append(deferFuncs, stopPusher)
log.Info("Started Prometheus Pushgateway pusher",
"url", nodeConfig.PrometheusPushgateway.URL,
"job", nodeConfig.PrometheusPushgateway.JobName,
"prefix", nodeConfig.PrometheusPushgateway.Prefix,
"instance", nodeConfig.PrometheusPushgateway.Instance,
"interval", nodeConfig.PrometheusPushgateway.UpdateInterval)
}

chainDb, l2BlockChain, err := openInitializeChainDb(ctx, stack, nodeConfig, new(big.Int).SetUint64(nodeConfig.Chain.ID), gethexec.DefaultCacheConfigFor(&nodeConfig.Execution.Caching), &nodeConfig.Execution.StylusTarget, tracer, &nodeConfig.Persistent, l1Client, initDigester, rollupAddrs)
if l2BlockChain != nil {
deferFuncs = append(deferFuncs, func() { l2BlockChain.Stop() })
Expand Down Expand Up @@ -776,29 +798,30 @@ func mainImpl() int {
}

type NodeConfig struct {
Conf genericconf.ConfConfig `koanf:"conf" reload:"hot"`
Node arbnode.Config `koanf:"node" reload:"hot"`
Execution gethexec.Config `koanf:"execution" reload:"hot"`
Validation valnode.Config `koanf:"validation" reload:"hot"`
ParentChain conf.ParentChainConfig `koanf:"parent-chain" reload:"hot"`
Chain conf.L2Config `koanf:"chain"`
LogLevel string `koanf:"log-level" reload:"hot"`
LogType string `koanf:"log-type" reload:"hot"`
FileLogging genericconf.FileLoggingConfig `koanf:"file-logging" reload:"hot"`
Persistent conf.PersistentConfig `koanf:"persistent"`
HTTP genericconf.HTTPConfig `koanf:"http"`
WS genericconf.WSConfig `koanf:"ws"`
IPC genericconf.IPCConfig `koanf:"ipc"`
Auth genericconf.AuthRPCConfig `koanf:"auth"`
GraphQL genericconf.GraphQLConfig `koanf:"graphql"`
Metrics bool `koanf:"metrics"`
MetricsServer genericconf.MetricsServerConfig `koanf:"metrics-server"`
PProf bool `koanf:"pprof"`
PprofCfg genericconf.PProf `koanf:"pprof-cfg"`
Init conf.InitConfig `koanf:"init"`
Rpc genericconf.RpcConfig `koanf:"rpc"`
BlocksReExecutor blocksreexecutor.Config `koanf:"blocks-reexecutor"`
EnsureRollupDeployment bool `koanf:"ensure-rollup-deployment" reload:"hot"`
Conf genericconf.ConfConfig `koanf:"conf" reload:"hot"`
Node arbnode.Config `koanf:"node" reload:"hot"`
Execution gethexec.Config `koanf:"execution" reload:"hot"`
Validation valnode.Config `koanf:"validation" reload:"hot"`
ParentChain conf.ParentChainConfig `koanf:"parent-chain" reload:"hot"`
Chain conf.L2Config `koanf:"chain"`
LogLevel string `koanf:"log-level" reload:"hot"`
LogType string `koanf:"log-type" reload:"hot"`
FileLogging genericconf.FileLoggingConfig `koanf:"file-logging" reload:"hot"`
Persistent conf.PersistentConfig `koanf:"persistent"`
HTTP genericconf.HTTPConfig `koanf:"http"`
WS genericconf.WSConfig `koanf:"ws"`
IPC genericconf.IPCConfig `koanf:"ipc"`
Auth genericconf.AuthRPCConfig `koanf:"auth"`
GraphQL genericconf.GraphQLConfig `koanf:"graphql"`
Metrics bool `koanf:"metrics"`
MetricsServer genericconf.MetricsServerConfig `koanf:"metrics-server"`
PrometheusPushgateway genericconf.PrometheusPushgatewayConfig `koanf:"prometheus-pushgateway"`
PProf bool `koanf:"pprof"`
PprofCfg genericconf.PProf `koanf:"pprof-cfg"`
Init conf.InitConfig `koanf:"init"`
Rpc genericconf.RpcConfig `koanf:"rpc"`
BlocksReExecutor blocksreexecutor.Config `koanf:"blocks-reexecutor"`
EnsureRollupDeployment bool `koanf:"ensure-rollup-deployment" reload:"hot"`
}

var NodeConfigDefault = NodeConfig{
Expand All @@ -819,6 +842,7 @@ var NodeConfigDefault = NodeConfig{
GraphQL: genericconf.GraphQLConfigDefault,
Metrics: false,
MetricsServer: genericconf.MetricsServerConfigDefault,
PrometheusPushgateway: genericconf.PrometheusPushgatewayConfigDefault,
Init: conf.InitConfigDefault,
Rpc: genericconf.DefaultRpcConfig,
PProf: false,
Expand All @@ -845,6 +869,7 @@ func NodeConfigAddOptions(f *flag.FlagSet) {
genericconf.GraphQLConfigAddOptions("graphql", f)
f.Bool("metrics", NodeConfigDefault.Metrics, "enable metrics")
genericconf.MetricsServerAddOptions("metrics-server", f)
genericconf.PrometheusPushgatewayAddOptions("prometheus-pushgateway", f)
f.Bool("pprof", NodeConfigDefault.PProf, "enable pprof")
genericconf.PProfAddOptions("pprof-cfg", f)

Expand Down
Loading