sc_transaction_pool/single_state_txpool/
metrics.rs1use crate::common::metrics::{GenericMetricsLink, MetricsRegistrant};
22use prometheus_endpoint::{register, Counter, PrometheusError, Registry, U64};
23
24pub type MetricsLink = GenericMetricsLink<Metrics>;
25
26pub struct Metrics {
28 pub submitted_transactions: Counter<U64>,
29 pub validations_invalid: Counter<U64>,
30 pub block_transactions_pruned: Counter<U64>,
31 pub block_transactions_resubmitted: Counter<U64>,
32}
33
34impl MetricsRegistrant for Metrics {
35 fn register(registry: &Registry) -> Result<Box<Self>, PrometheusError> {
36 Ok(Box::from(Self {
37 submitted_transactions: register(
38 Counter::new(
39 "substrate_sub_txpool_submitted_transactions",
40 "Total number of transactions submitted",
41 )?,
42 registry,
43 )?,
44 validations_invalid: register(
45 Counter::new(
46 "substrate_sub_txpool_validations_invalid",
47 "Total number of transactions that were removed from the pool as invalid",
48 )?,
49 registry,
50 )?,
51 block_transactions_pruned: register(
52 Counter::new(
53 "substrate_sub_txpool_block_transactions_pruned",
54 "Total number of transactions that was requested to be pruned by block events",
55 )?,
56 registry,
57 )?,
58 block_transactions_resubmitted: register(
59 Counter::new(
60 "substrate_sub_txpool_block_transactions_resubmitted",
61 "Total number of transactions that was requested to be resubmitted by block events",
62 )?,
63 registry,
64 )?,
65 }))
66 }
67}