Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Clean up metrics.
  • Loading branch information
tomusdrw committed May 27, 2020
commit 9b25e4583a333610c48c57116bd19c06817b714a
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion validation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ bitvec = { version = "0.17.4", default-features = false, features = ["alloc"] }
runtime_babe = { package = "pallet-babe", git = "https://github.com/paritytech/substrate", branch = "master" }
babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master" }
keystore = { package = "sc-keystore", git = "https://github.com/paritytech/substrate", branch = "master" }
sc-proposer-metrics = { git = "https://github.com/paritytech/substrate", branch = "master" }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch = "master" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "master" }

Expand Down
18 changes: 3 additions & 15 deletions validation/src/block_production.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ use inherents::InherentData;
use sp_timestamp::TimestampInherentData;
use sp_api::{ApiExt, ProvideRuntimeApi};
use prometheus_endpoint::Registry as PrometheusRegistry;
use sc_proposer_metrics::MetricsLink as PrometheusMetrics;

use crate::{
Error,
Expand All @@ -53,7 +52,6 @@ use crate::{
pub struct ProposerFactory<Client, TxPool, Backend> {
service_handle: ServiceHandle,
babe_slot_duration: u64,
metrics: PrometheusMetrics,
factory: sc_basic_authorship::ProposerFactory<TxPool, Backend, Client>,
}

Expand All @@ -69,12 +67,11 @@ impl<Client, TxPool, Backend> ProposerFactory<Client, TxPool, Backend> {
let factory = sc_basic_authorship::ProposerFactory::new(
client,
transaction_pool,
prometheus.clone(),
prometheus,
);
ProposerFactory {
service_handle: service_handle,
service_handle,
babe_slot_duration,
metrics: PrometheusMetrics::new(prometheus),
factory,
}
}
Expand Down Expand Up @@ -106,7 +103,6 @@ where
) -> Self::CreateProposer {
let parent_hash = parent_header.hash();
let slot_duration = self.babe_slot_duration.clone();
let metrics = self.metrics.clone();
let proposer = self.factory.init(parent_header).into_inner();

let maybe_proposer = self.service_handle
Expand All @@ -117,7 +113,6 @@ where
.map(|proposer| Proposer {
tracker,
slot_duration,
metrics,
proposer: Some(proposer),
})
));
Expand All @@ -130,7 +125,6 @@ where
pub struct Proposer<Client, TxPool: TransactionPool<Block=Block>, Backend> {
tracker: crate::validation_service::ValidationInstanceHandle,
slot_duration: u64,
metrics: PrometheusMetrics,
proposer: Option<sc_basic_authorship::Proposer<Backend, Block, Client, TxPool>>,
}

Expand Down Expand Up @@ -169,11 +163,9 @@ impl<Client, TxPool, Backend> consensus::Proposer<Block> for Proposer<Client, Tx
);

let table = self.tracker.table().clone();
let metrics = self.metrics.clone();
let mut proposer = self.proposer.take().expect("Only one block proposed.");
let mut proposer = self.proposer.take().expect("Only one block proposed per proposer; qed");

async move {
let block_timer = metrics.report(|metrics| metrics.block_constructed.start_timer());
let enough_candidates = dynamic_inclusion.acceptable_in(
now,
initial_included,
Expand Down Expand Up @@ -208,10 +200,6 @@ impl<Client, TxPool, Backend> consensus::Proposer<Block> for Proposer<Client, Tx
record_proof
).await;

drop(block_timer);
let transactions = result.as_ref().map(|proposal| proposal.block.extrinsics.len()).unwrap_or_default();
metrics.report(|metrics| metrics.number_of_transactions.set(transactions as u64));

Ok(result?)
}.boxed()
}
Expand Down