diff --git a/prdoc/pr_5250.prdoc b/prdoc/pr_5250.prdoc new file mode 100644 index 0000000000000..2cac6b2383e34 --- /dev/null +++ b/prdoc/pr_5250.prdoc @@ -0,0 +1,12 @@ +title: Export `MetricsService` and add public constructor to `RpcHandlers` + +doc: + - audience: Node Dev + description: | + `sc-service` was missing just a couple of things in public API in order to make it possible to recreate its + `spawn_tasks`, specifically `MetricsService` struct and `RpcHandlers` didn't have public constructor, which were + both finally addressed. + +crates: + - name: sc-service + bump: patch diff --git a/substrate/client/service/src/builder.rs b/substrate/client/service/src/builder.rs index ebe3f553f7c28..d7fb7918481cd 100644 --- a/substrate/client/service/src/builder.rs +++ b/substrate/client/service/src/builder.rs @@ -509,7 +509,7 @@ where }; let rpc = start_rpc_servers(&config, gen_rpc_module, rpc_id_provider)?; - let rpc_handlers = RpcHandlers(Arc::new(gen_rpc_module(sc_rpc::DenyUnsafe::No)?.into())); + let rpc_handlers = RpcHandlers::new(Arc::new(gen_rpc_module(sc_rpc::DenyUnsafe::No)?.into())); // Spawn informant task spawn_handle.spawn( diff --git a/substrate/client/service/src/lib.rs b/substrate/client/service/src/lib.rs index 63be296d1b216..89d563001cd6d 100644 --- a/substrate/client/service/src/lib.rs +++ b/substrate/client/service/src/lib.rs @@ -62,6 +62,7 @@ pub use self::{ }, client::{ClientConfig, LocalCallExecutor}, error::Error, + metrics::MetricsService, }; #[allow(deprecated)] pub use builder::new_native_or_wasm_executor; @@ -101,6 +102,11 @@ const DEFAULT_PROTOCOL_ID: &str = "sup"; pub struct RpcHandlers(Arc>); impl RpcHandlers { + /// Create PRC handlers instance. + pub fn new(inner: Arc>) -> Self { + Self(inner) + } + /// Starts an RPC query. /// /// The query is passed as a string and must be valid JSON-RPC request object.