mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 00:41:03 +00:00
Telemetry per node (#7463)
This commit is contained in:
@@ -96,6 +96,11 @@ pub struct Configuration {
|
||||
/// 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<ExtTransport>,
|
||||
/// Telemetry handle.
|
||||
///
|
||||
/// 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>,
|
||||
/// The default number of 64KB pages to allocate for Wasm execution
|
||||
pub default_heap_pages: Option<u64>,
|
||||
/// Should offchain workers be executed.
|
||||
@@ -198,9 +203,22 @@ impl Configuration {
|
||||
}
|
||||
|
||||
/// Returns the prometheus metrics registry, if available.
|
||||
pub fn prometheus_registry<'a>(&'a self) -> Option<&'a Registry> {
|
||||
pub fn prometheus_registry(&self) -> Option<&Registry> {
|
||||
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;
|
||||
}
|
||||
|
||||
match self.telemetry_endpoints.as_ref() {
|
||||
// Don't initialise telemetry if `telemetry_endpoints` == Some([])
|
||||
Some(endpoints) if !endpoints.is_empty() => Some(endpoints),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Available RPC methods.
|
||||
|
||||
Reference in New Issue
Block a user