From db71e0cc480b190b290cab4dbc881d5896ef41ab Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 26 Jun 2019 09:05:49 +0200 Subject: [PATCH] Expose the telemetry external transport in the config (#2939) * Expose the telemetry external transport in the config * Fix tests --- substrate/core/network/src/lib.rs | 2 +- substrate/core/service/src/config.rs | 5 +++++ substrate/core/service/src/lib.rs | 2 +- substrate/core/service/test/src/lib.rs | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/substrate/core/network/src/lib.rs b/substrate/core/network/src/lib.rs index 44ca7eab4c..caf4ca20ee 100644 --- a/substrate/core/network/src/lib.rs +++ b/substrate/core/network/src/lib.rs @@ -188,7 +188,7 @@ pub use config::{NodeKeyConfig, Secret, Secp256k1Secret, Ed25519Secret}; pub use protocol::{PeerInfo, Context, consensus_gossip, message, specialization}; pub use protocol::sync::SyncState; pub use libp2p::{Multiaddr, multiaddr, build_multiaddr}; -pub use libp2p::{identity, PeerId, core::PublicKey}; +pub use libp2p::{identity, PeerId, core::PublicKey, wasm_ext::ExtTransport}; pub use message::{generic as generic_message, RequestId, Status as StatusMessage}; pub use error::Error; diff --git a/substrate/core/service/src/config.rs b/substrate/core/service/src/config.rs index 3a49630898..92f9882ff9 100644 --- a/substrate/core/service/src/config.rs +++ b/substrate/core/service/src/config.rs @@ -21,6 +21,7 @@ use transaction_pool; use crate::chain_spec::ChainSpec; pub use client::ExecutionStrategies; pub use client_db::PruningMode; +pub use network::ExtTransport; pub use network::config::{NetworkConfiguration, Roles}; use runtime_primitives::BuildStorage; use serde::{Serialize, de::DeserializeOwned}; @@ -74,6 +75,9 @@ pub struct Configuration { pub rpc_cors: Option>, /// Telemetry service URL. `None` if disabled. pub telemetry_endpoints: Option, + /// External WASM transport for the telemetry. If `Some`, when connection to a telemetry + /// endpoint, this transport will be tried in priority before all others. + pub telemetry_external_transport: Option, /// The default number of 64KB pages to allocate for Wasm execution pub default_heap_pages: Option, /// Should offchain workers be executed. @@ -112,6 +116,7 @@ impl Configuration Service { let telemetry_connection_sinks_ = telemetry_connection_sinks.clone(); let telemetry = tel::init_telemetry(tel::TelemetryConfig { endpoints, - wasm_external_transport: None, + wasm_external_transport: config.telemetry_external_transport.take(), }); let future = telemetry.clone() .for_each(move |event| { diff --git a/substrate/core/service/test/src/lib.rs b/substrate/core/service/test/src/lib.rs index d3d9677bb2..e8d45750fd 100644 --- a/substrate/core/service/test/src/lib.rs +++ b/substrate/core/service/test/src/lib.rs @@ -151,6 +151,7 @@ fn node_config ( rpc_ws_max_connections: None, rpc_cors: None, telemetry_endpoints: None, + telemetry_external_transport: None, default_heap_pages: None, offchain_worker: false, force_authoring: false,