diff --git a/README.md b/README.md index e11fe25..32d8106 100644 --- a/README.md +++ b/README.md @@ -59,10 +59,12 @@ COMMANDS: help, h Shows a list of commands or help for one command GLOBAL OPTIONS: + --chain-id value to ensure all nodes matches the specific network (dismiss to auto-detected) --http-addr value http server address (default: ":8080") --namespace value namespace for Prometheus metrics (default: "cosmos_validator_watcher") --no-color disable colored output (default: false) - --node value [ --node value ] RPC node endpoint to connect to (speficied multiple nodes for high availability) (default: "http://localhost:26657") + --node value [ --node value ] rpc node endpoint to connect to (specify multiple for high availability) (default: "http://localhost:26657") + --no-staking disable calls to staking module (useful for consumer chains) (default: false) --validator value [ --validator value ] validator address(es) to track (use :my-label to add a custom label in metrics & ouput) --help, -h show help --version, -v print the version diff --git a/pkg/app/flags.go b/pkg/app/flags.go index f1d30d0..45ae139 100644 --- a/pkg/app/flags.go +++ b/pkg/app/flags.go @@ -23,9 +23,13 @@ var Flags = []cli.Flag{ }, &cli.StringSliceFlag{ Name: "node", - Usage: "RPC node endpoint to connect to (speficied multiple nodes for high availability)", + Usage: "rpc node endpoint to connect to (specify multiple for high availability)", Value: cli.NewStringSlice("http://localhost:26657"), }, + &cli.BoolFlag{ + Name: "no-staking", + Usage: "disable calls to staking module (useful for consumer chains)", + }, &cli.StringSliceFlag{ Name: "validator", Usage: "validator address(es) to track (use :my-label to add a custom label in metrics & ouput)", diff --git a/pkg/app/run.go b/pkg/app/run.go index 9c6b50a..56c5ec7 100644 --- a/pkg/app/run.go +++ b/pkg/app/run.go @@ -34,6 +34,7 @@ func RunFunc(cCtx *cli.Context) error { namespace = cCtx.String("namespace") noColor = cCtx.Bool("no-color") nodes = cCtx.StringSlice("node") + noStaking = cCtx.Bool("no-staking") validators = cCtx.StringSlice("validator") // Channels used to send data from watchers to the exporter @@ -119,6 +120,7 @@ func RunFunc(cCtx *cli.Context) error { BlockChan: blockChan, StatusChan: statusChan, ValidatorsChan: validatorsChan, + DisableStaking: noStaking, }) return watchers[i].Start(ctx) diff --git a/pkg/watcher/watcher.go b/pkg/watcher/watcher.go index 672b821..eac5b3d 100644 --- a/pkg/watcher/watcher.go +++ b/pkg/watcher/watcher.go @@ -21,6 +21,7 @@ type Config struct { StatusChan chan<- NodeEvent[*ctypes.ResultStatus] BlockChan chan<- NodeEvent[*types.Block] ValidatorsChan chan<- NodeEvent[[]stakingtypes.Validator] + DisableStaking bool } type Watcher struct { @@ -218,7 +219,7 @@ func (w *Watcher) getValidators(ctx context.Context) ([]*types.Validator, error) } func (w *Watcher) syncStakingValidators(ctx context.Context) error { - if !w.Ready() { + if w.cfg.DisableStaking || !w.Ready() { return nil }