From 1a3780aa793e17bf98670a7324d7d8975b9cad5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 27 Oct 2020 21:55:12 +0100 Subject: [PATCH] Fix proposer factory prometheus registration (#1862) The proposer wasn't registered in prometheus and thus, we could not see its metrics. --- polkadot/Cargo.lock | 1 + polkadot/node/core/proposer/Cargo.toml | 1 + polkadot/node/core/proposer/src/lib.rs | 4 +++- polkadot/node/service/src/lib.rs | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/polkadot/Cargo.lock b/polkadot/Cargo.lock index f72fa3c6f4..590e6273da 100644 --- a/polkadot/Cargo.lock +++ b/polkadot/Cargo.lock @@ -4980,6 +4980,7 @@ dependencies = [ "sp-inherents", "sp-runtime", "sp-transaction-pool", + "substrate-prometheus-endpoint", "wasm-timer", ] diff --git a/polkadot/node/core/proposer/Cargo.toml b/polkadot/node/core/proposer/Cargo.toml index 3205b50b5b..b565f7c8a6 100644 --- a/polkadot/node/core/proposer/Cargo.toml +++ b/polkadot/node/core/proposer/Cargo.toml @@ -20,4 +20,5 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch = "master" } wasm-timer = "0.2.4" diff --git a/polkadot/node/core/proposer/src/lib.rs b/polkadot/node/core/proposer/src/lib.rs index 89a4060621..cb08ab5c89 100644 --- a/polkadot/node/core/proposer/src/lib.rs +++ b/polkadot/node/core/proposer/src/lib.rs @@ -33,6 +33,7 @@ use sp_consensus::{Proposal, RecordProof}; use sp_inherents::InherentData; use sp_runtime::traits::{DigestFor, HashFor}; use sp_transaction_pool::TransactionPool; +use prometheus_endpoint::Registry as PrometheusRegistry; use std::{fmt, pin::Pin, sync::Arc, time}; /// How long proposal can take before we give up and err out @@ -50,13 +51,14 @@ impl ProposerFactory { client: Arc, transaction_pool: Arc, overseer: OverseerHandler, + prometheus: Option<&PrometheusRegistry>, ) -> Self { ProposerFactory { inner: sc_basic_authorship::ProposerFactory::new( spawn_handle, client, transaction_pool, - None, + prometheus, ), overseer, } diff --git a/polkadot/node/service/src/lib.rs b/polkadot/node/service/src/lib.rs index c7a1af7c82..be8c3b197a 100644 --- a/polkadot/node/service/src/lib.rs +++ b/polkadot/node/service/src/lib.rs @@ -460,6 +460,7 @@ pub fn new_full( client.clone(), transaction_pool, overseer_handler.clone(), + prometheus_registry.as_ref(), ); let babe_config = babe::BabeParams {