Fix telemetry span not entering properly & enter span in sc-cli (#7951)

* WIP

* WIP

* Test

* bug fix

* WIP

* Revert "WIP"

This reverts commit 4e51e9adfdf0dc7cf37b562b60a0e83ca1d0b00d.

* doc

* Improve comment on why all spans are preserved

* Added missing suggestion from previous PR

* Use BoxFuture

* Move TelemetrySpan creation to sc-cli, need to test...

* Test code

* Adapt user code

* Revert "Test code"

This reverts commit 333806b2fe1626efaa2691f9f44d0b4dd979bc36.

* Update client/service/src/task_manager/mod.rs

Co-authored-by: David <dvdplm@gmail.com>

* Better & simpler solution

Co-authored-by: David <dvdplm@gmail.com>
This commit is contained in:
Cecile Tonglet
2021-01-29 13:03:21 +01:00
committed by GitHub
parent 4268fa0996
commit bea4a6524d
9 changed files with 47 additions and 54 deletions
+4 -10
View File
@@ -101,6 +101,10 @@ pub struct Configuration {
/// This is a handle to a `TelemetryWorker` instance. It is used to initialize the telemetry for
/// a substrate node.
pub telemetry_handle: Option<sc_telemetry::TelemetryHandle>,
/// Telemetry span.
///
/// This span is entered for every background task spawned using the TaskManager.
pub telemetry_span: Option<sc_telemetry::TelemetrySpan>,
/// The default number of 64KB pages to allocate for Wasm execution
pub default_heap_pages: Option<u64>,
/// Should offchain workers be executed.
@@ -207,16 +211,6 @@ impl Configuration {
self.prometheus_config.as_ref().map(|config| &config.registry)
}
/// Returns the telemetry endpoints if any and if the telemetry handle exists.
pub(crate) fn telemetry_endpoints(&self) -> Option<&TelemetryEndpoints> {
if self.telemetry_handle.is_none() {
return None;
}
// Don't initialise telemetry if `telemetry_endpoints` == Some([])
self.telemetry_endpoints.as_ref().filter(|x| !x.is_empty())
}
/// Returns the network protocol id from the chain spec, or the default.
pub fn protocol_id(&self) -> sc_network::config::ProtocolId {
let protocol_id_full = match self.chain_spec.protocol_id() {