paritytech / cumulus

Write Parachains on Substrate
GNU General Public License v3.0
617 stars 378 forks source link

Collators metrics polkadot_node_is_active_validator #2644

Open BulatSaif opened 1 year ago

BulatSaif commented 1 year ago

I notice that the collator does not have polkadot_node_is_active_validator metric and I did not find any alternative. But relaychain part of the collator reports polkadot_node_is_active_validator=0 which creates false positive alerts.

  1. can we have polkadot_node_is_active_validator or a similar metric for parachain
  2. can we remove polkadot_node_is_active_validator from relaychain part of the collator if the --validator flag is not provided

Example of metrics:

polkadot_node_is_active_validator{chain="ksmcc3", instance="kusama-bridge-hub-collator-ue4-1", job="parachain", node="kusama-bridge-hub-collator-ue4-1", node_role="collator"}

cli which was used to run a node, as you can see no flag --validator only --collator but it set for parachain.

/home/parity/bin/kusama-bridge-hub --base-path /opt/chain-data --detailed-log-output --name kusama-bridge-hub-collator-ue4-1 --collator  --chain /home/parity/chainspecs/kusama-bridge-hub_parachain_chainspec.json --listen-addr=/ip4/0.0.0.0/tcp/30334 --in-peers 25 --out-peers 25  --state-pruning=archive -lparachain=debug,author=debug --prometheus-external --prometheus-port 9615 --ws-port 9955 --ws-max-connections 100 --rpc-port 9943 --wasm-execution=Compiled --execution wasm -- --name kusama-bridge-hub-collator-ue4-1 --chain kusama --listen-addr=/ip4/0.0.0.0/tcp/30333  --in-peers 25 --out-peers 25 --db-cache 512  --state-pruning=1000 --prometheus-external --prometheus-port 9625 --ws-port 9944 --ws-max-connections 100 --rpc-port 9933 --execution wasm
bkchr commented 1 year ago
  1. can we have polkadot_node_is_active_validator or a similar metric for parachain

Probably better to remove this entirely and move the metric to Substrate.

2. can we remove polkadot_node_is_active_validator from relaychain part of the collator if the --validator flag is not provided

I would not remove metrics based on some flag. People will be confused why the flag doesn't exist.

BulatSaif commented 1 year ago

I would not remove metrics based on some flag.

Me too, but it is current behavior of Polkadot:

  1. Validator node (--validator added)
    # docker run -p 9615:9615 -it --rm parity/polkadot:v0.9.42 --prometheus-external --validator
    curl -s 127.0.0.1:9615/metrics | grep  polkadot_node_is_active_validator
    # HELP polkadot_node_is_active_validator Tracks if the validator is in the active set. Updates at session boundary.
    # TYPE polkadot_node_is_active_validator gauge
    polkadot_node_is_active_validator{chain="polkadot"} 0
  2. Normal node
    
    # docker run -p 9615:9615 -it --rm parity/polkadot:v0.9.42 --prometheus-external 

curl -s 127.0.0.1:9615/metrics | grep polkadot_node_is_active_validator

empty line


It will be nice to have constancy between the standalone relaychain and embedded relaycahin in collator.
bkchr commented 1 year ago

Ahh yeah because the subsystem doing this is not registered.