mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 19:21:13 +00:00
Add new hardware and software metrics (#11062)
* Add new hardware and software metrics * Move sysinfo tests into `mod tests` * Correct a typo in a comment * Remove unnecessary `nix` dependency * Fix the version tests * Add a `--disable-hardware-benchmarks` CLI argument * Disable hardware benchmarks in the integration tests * Remove unused import * Fix benchmarks compilation * Move code to a new `sc-sysinfo` crate * Correct `impl_version` comment * Move `--disable-hardware-benchmarks` to the chain-specific bin crate * Move printing out of hardware bench results to `sc-sysinfo` * Move hardware benchmarks to a separate messages; trigger them manually * Rename some of the fields in the `HwBench` struct * Revert changes to the telemetry crate; manually send hwbench messages * Move sysinfo logs into the sysinfo crate * Move the `TARGET_OS_*` constants into the sysinfo crate * Minor cleanups * Move the `HwBench` struct to the sysinfo crate * Derive `Clone` for `HwBench` * Fix broken telemetry connection notification stream * Prevent the telemetry connection notifiers from leaking if they're disconnected * Turn the telemetry notification failure log into a debug log * Rename `--disable-hardware-benchmarks` to `--no-hardware-benchmarks`
This commit is contained in:
@@ -101,6 +101,38 @@ pub struct ConnectionMessage {
|
||||
pub startup_time: String,
|
||||
/// Node's network ID.
|
||||
pub network_id: String,
|
||||
|
||||
/// Node's OS.
|
||||
pub target_os: String,
|
||||
|
||||
/// Node's ISA.
|
||||
pub target_arch: String,
|
||||
|
||||
/// Node's target platform ABI or libc.
|
||||
pub target_env: String,
|
||||
|
||||
/// Node's software and hardware information.
|
||||
pub sysinfo: Option<SysInfo>,
|
||||
}
|
||||
|
||||
/// Hardware and software information for the node.
|
||||
///
|
||||
/// Gathering most of this information is highly OS-specific,
|
||||
/// so most of the fields here are optional.
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct SysInfo {
|
||||
/// The exact CPU model.
|
||||
pub cpu: Option<String>,
|
||||
/// The total amount of memory, in bytes.
|
||||
pub memory: Option<u64>,
|
||||
/// The number of physical CPU cores.
|
||||
pub core_count: Option<u32>,
|
||||
/// The Linux kernel version.
|
||||
pub linux_kernel: Option<String>,
|
||||
/// The exact Linux distribution used.
|
||||
pub linux_distro: Option<String>,
|
||||
/// Whether the node's running under a virtual machine.
|
||||
pub is_virtual_machine: Option<bool>,
|
||||
}
|
||||
|
||||
/// Telemetry worker.
|
||||
|
||||
@@ -179,8 +179,20 @@ where
|
||||
Poll::Ready(Ok(sink)) => {
|
||||
log::debug!(target: "telemetry", "✅ Connected to {}", self.addr);
|
||||
|
||||
for sender in self.telemetry_connection_notifier.iter_mut() {
|
||||
let _ = sender.send(());
|
||||
{
|
||||
let mut index = 0;
|
||||
while index < self.telemetry_connection_notifier.len() {
|
||||
let sender = &mut self.telemetry_connection_notifier[index];
|
||||
if let Err(error) = sender.try_send(()) {
|
||||
if !error.is_disconnected() {
|
||||
log::debug!(target: "telemetry", "Failed to send a telemetry connection notification: {}", error);
|
||||
} else {
|
||||
self.telemetry_connection_notifier.swap_remove(index);
|
||||
continue
|
||||
}
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
let buf = self
|
||||
|
||||
Reference in New Issue
Block a user