Skip to main content

near_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 near_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    pub protocol_version: u32,
13}
14
15#[derive(serde::Serialize, Debug)]
16pub struct TelemetrySystemInfo {
17    pub bandwidth_download: u64,
18    pub bandwidth_upload: u64,
19    pub cpu_usage: f32,
20    pub memory_usage: u64,
21    pub boot_time_seconds: i64,
22}
23
24#[derive(serde::Serialize, Debug)]
25pub struct TelemetryChainInfo {
26    pub chain_id: String,
27    pub node_id: String,
28    pub account_id: Option<AccountId>,
29    pub is_validator: bool,
30    pub status: String,
31    pub latest_block_hash: CryptoHash,
32    pub latest_block_height: BlockHeight,
33    pub num_peers: usize,
34    pub block_production_tracking_delay: f64,
35    pub min_block_production_delay: f64,
36    pub max_block_production_delay: f64,
37    pub max_block_wait_delay: f64,
38}
39
40#[derive(serde::Serialize, Debug)]
41pub struct TelemetryInfo {
42    pub agent: TelemetryAgentInfo,
43    pub system: TelemetrySystemInfo,
44    pub chain: TelemetryChainInfo,
45    // Extra telemetry information that will be ignored by the explorer frontend.
46    pub extra_info: String,
47}