unc_primitives/
telemetry.rs

1//! Types for telemetry reporting. Can be received by any telemetry dashboard to display
2//! node count and their status across the network.
3use crate::types::AccountId;
4use crate::types::BlockHeight;
5use unc_primitives_core::hash::CryptoHash;
6
7#[derive(serde::Serialize, Debug)]
8pub struct TelemetryAgentInfo {
9    pub name: String,
10    pub version: String,
11    pub build: String,
12}
13
14#[derive(serde::Serialize, Debug)]
15pub struct TelemetrySystemInfo {
16    pub bandwidth_download: u64,
17    pub bandwidth_upload: u64,
18    pub cpu_usage: f32,
19    pub memory_usage: u64,
20    pub boot_time_seconds: i64,
21}
22
23#[derive(serde::Serialize, Debug)]
24pub struct TelemetryChainInfo {
25    pub node_id: String,
26    pub account_id: Option<AccountId>,
27    pub is_validator: bool,
28    pub status: String,
29    pub latest_block_hash: CryptoHash,
30    pub latest_block_height: BlockHeight,
31    pub num_peers: usize,
32    pub block_production_tracking_delay: f64,
33    pub min_block_production_delay: f64,
34    pub max_block_production_delay: f64,
35    pub max_block_wait_delay: f64,
36}
37
38#[derive(serde::Serialize, Debug)]
39pub struct TelemetryInfo {
40    pub agent: TelemetryAgentInfo,
41    pub system: TelemetrySystemInfo,
42    pub chain: TelemetryChainInfo,
43    // Extra telemetry information that will be ignored by the explorer frontend.
44    pub extra_info: String,
45}