mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 07:41:08 +00:00
Pass Prometheus Registry into Client (#5120)
* Add a few metrics to Client * Improve PrometheusConfig * Fix client docs
This commit is contained in:
@@ -78,6 +78,7 @@ pub use sc_client_api::{
|
||||
CallExecutor,
|
||||
};
|
||||
use sp_blockchain::Error;
|
||||
use prometheus_endpoint::Registry;
|
||||
|
||||
use crate::{
|
||||
call_executor::LocalCallExecutor,
|
||||
@@ -171,6 +172,7 @@ pub fn new_in_mem<E, Block, S, RA>(
|
||||
executor: E,
|
||||
genesis_storage: &S,
|
||||
keystore: Option<sp_core::traits::BareCryptoStorePtr>,
|
||||
prometheus_registry: Option<Registry>,
|
||||
) -> sp_blockchain::Result<Client<
|
||||
in_mem::Backend<Block>,
|
||||
LocalCallExecutor<in_mem::Backend<Block>, E>,
|
||||
@@ -181,7 +183,7 @@ pub fn new_in_mem<E, Block, S, RA>(
|
||||
S: BuildStorage,
|
||||
Block: BlockT,
|
||||
{
|
||||
new_with_backend(Arc::new(in_mem::Backend::new()), executor, genesis_storage, keystore)
|
||||
new_with_backend(Arc::new(in_mem::Backend::new()), executor, genesis_storage, keystore, prometheus_registry)
|
||||
}
|
||||
|
||||
/// Create a client with the explicitly provided backend.
|
||||
@@ -191,6 +193,7 @@ pub fn new_with_backend<B, E, Block, S, RA>(
|
||||
executor: E,
|
||||
build_genesis_storage: &S,
|
||||
keystore: Option<sp_core::traits::BareCryptoStorePtr>,
|
||||
prometheus_registry: Option<Registry>,
|
||||
) -> sp_blockchain::Result<Client<B, LocalCallExecutor<B, E>, Block, RA>>
|
||||
where
|
||||
E: CodeExecutor + RuntimeInfo,
|
||||
@@ -207,6 +210,7 @@ pub fn new_with_backend<B, E, Block, S, RA>(
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
extensions,
|
||||
prometheus_registry,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -286,6 +290,7 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
|
||||
fork_blocks: ForkBlocks<Block>,
|
||||
bad_blocks: BadBlocks<Block>,
|
||||
execution_extensions: ExecutionExtensions<Block>,
|
||||
_prometheus_registry: Option<Registry>,
|
||||
) -> sp_blockchain::Result<Self> {
|
||||
if backend.blockchain().header(BlockId::Number(Zero::zero()))?.is_none() {
|
||||
let genesis_storage = build_genesis_storage.build_storage()?;
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
//! Default::default(),
|
||||
//! Default::default(),
|
||||
//! Default::default(),
|
||||
//! None,
|
||||
//! );
|
||||
//! ```
|
||||
//!
|
||||
|
||||
@@ -28,6 +28,7 @@ use sp_core::traits::CodeExecutor;
|
||||
use sp_runtime::BuildStorage;
|
||||
use sp_runtime::traits::{Block as BlockT, HashFor};
|
||||
use sp_blockchain::Result as ClientResult;
|
||||
use prometheus_endpoint::Registry;
|
||||
|
||||
use crate::call_executor::LocalCallExecutor;
|
||||
use crate::client::Client;
|
||||
@@ -58,6 +59,7 @@ pub fn new_light<B, S, GS, RA, E>(
|
||||
backend: Arc<Backend<S, HashFor<B>>>,
|
||||
genesis_storage: &GS,
|
||||
code_executor: E,
|
||||
prometheus_registry: Option<Registry>,
|
||||
) -> ClientResult<
|
||||
Client<
|
||||
Backend<S, HashFor<B>>,
|
||||
@@ -84,6 +86,7 @@ pub fn new_light<B, S, GS, RA, E>(
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
prometheus_registry,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user