message: Share metrics registry across components
diff: @@ -18,6 +18,7 @@ use casper_node::{
  reactor::{initializer, joiner, validator, Runner},
  utils::WithDir,
  };
  +use prometheus::Registry;
  // Note: The docstring on `Cli` is the help shown when calling the binary with `--help`.
  #[derive(Debug, StructOpt)]
  @@ -140,9 +141,13 @@ impl Cli {
  // performance reasons.
  let mut rng = ChaCha20Rng::from_entropy();
  - let mut initializer_runner = Runner::<initializer::Reactor, _>::new(
  + // The metrics are shared across all reactors.
  + let registry = Registry::new();
  +
  + let mut initializer_runner = Runner::<initializer::Reactor, _>::with_metrics(
  WithDir::new(root.clone(), validator_config),
  &mut rng,
  + &registry,
  )
  .await?;
  initializer_runner.run(&mut rng).await;
  @@ -154,8 +159,11 @@ impl Cli {
  bail!("failed to initialize successfully");
  }
  - let mut joiner_runner =
  - Runner::<joiner::Reactor<_>, _>::new(WithDir::new(root, initializer), &mut rng)
  + let mut joiner_runner = Runner::<joiner::Reactor<_>, _>::with_metrics(
  + WithDir::new(root, initializer),
  + &mut rng,
  + &registry,
  + )
  .await?;
  joiner_runner.run(&mut rng).await;
  @@ -164,7 +172,8 @@ impl Cli {
  let config = joiner_runner.into_inner().into_validator_config().await;
  let mut validator_runner =
  - Runner::<validator::Reactor<_>, _>::new(config, &mut rng).await?;
  + Runner::<validator::Reactor<_>, _>::with_metrics(config, &mut rng, &registry)
  + .await?;
  validator_runner.run(&mut rng).await;
  }
  }
  