-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Map Node Stats (Version, Operating System etc) to each Node in Feed #587
Conversation
User @CyndieKamau, please sign the CLA here. |
(&None, &None, &None) | ||
}; | ||
let ip = if *expose_node_details { &details.ip } else { &None }; | ||
let sys_info = &details.sysinfo; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how I feel about sys_info
no longer respecting the --expose-node-details
flag. I think the point of this flag is to provide some privacy for nodes on the default telemetry instance, since they will connect to it by default (ie they aren't explicitly opting in to having their details shared). Then, on eg the 1kv telemetry instance we allow node details to be exposed since nodes must opt in to sharing telemetry there anyway.
It's debatable whether this privacy is required or not for the system info though. Perhaps there is a case for hiding IPs but exposing the hardware details, but I'd want to ask around a bit on this and gather some thoughts.
@@ -16,7 +16,7 @@ | |||
|
|||
use super::counter::{Counter, CounterValue}; | |||
use crate::feed_message::ChainStats; | |||
|
|||
//use arrayvec::ArrayString; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: remove?
use crate::feed_message::Ranking; | ||
use std::collections::HashMap; | ||
use std::{collections::HashMap, /*str::FromStr*/}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use std::{collections::HashMap, /*str::FromStr*/}; | |
use std::collections::HashMap; |
backend/common/src/node_types.rs
Outdated
@@ -38,7 +38,7 @@ pub struct NodeDetails { | |||
pub validator: Option<Box<str>>, | |||
pub network_id: NetworkId, | |||
pub startup_time: Option<Box<str>>, | |||
pub target_os: Option<Box<str>>, | |||
pub target_os: Option<Box<str>>, //starts here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub target_os: Option<Box<str>>, //starts here | |
pub target_os: Option<Box<str>>, |
@@ -19,5 +19,5 @@ | |||
mod hash; | |||
mod node_message; | |||
|
|||
pub use hash::Hash; | |||
//pub use hash::Hash; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//pub use hash::Hash; |
/// Ranking list out node details elements per node id and counts per elements | ||
/// `list`: List of node detail element per its count [( item, count )] | ||
/// `node_map`: A map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment doesn't make sense to me :)
frontend/src/components/List/Row.css
Outdated
@@ -44,5 +44,5 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. | |||
} | |||
|
|||
.Row:hover { | |||
background-color: #1e1e1e; | |||
background-color: #1e1e1e; /*remember to change to #1e1e1e*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
background-color: #1e1e1e; /*remember to change to #1e1e1e*/ | |
background-color: #1e1e1e; |
frontend/src/components/List/Row.tsx
Outdated
@@ -86,6 +104,9 @@ export class Row extends React.Component<RowProps, RowState> { | |||
public render() { | |||
const { node, columns } = this.props; | |||
|
|||
console.log('node details:',node ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove?
frontend/src/App.tsx
Outdated
@@ -71,6 +72,20 @@ export default class App extends React.Component { | |||
blockpropagation: true, | |||
blocklasttime: false, | |||
uptime: false, | |||
version: true, //starts here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version: true, //starts here | |
version: true, |
frontend/src/Connection.ts
Outdated
@@ -133,7 +133,7 @@ export class Connection { | |||
this.bindSocket(); | |||
} | |||
|
|||
public subscribe(chain: Types.GenesisHash) { | |||
public subscribe(chain: Types.GenesisHash) { //It has subscribed to the telemetry core |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove or add proper comment above?
frontend/src/state.ts
Outdated
@@ -255,6 +291,22 @@ export interface StateSettings { | |||
blockpropagation: boolean; | |||
blocklasttime: boolean; | |||
uptime: boolean; | |||
|
|||
version: boolean; //starts here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version: boolean; //starts here | |
version: boolean; |
frontend/src/common/feed.ts
Outdated
@@ -98,7 +98,8 @@ interface AddedNodeMessage extends MessageBase { | |||
NodeHardware, | |||
BlockDetails, | |||
Maybe<NodeLocation>, | |||
Maybe<Timestamp> | |||
Maybe<Timestamp>, | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove empty line?
|
||
/// The map of Node Id ( Network Id) to the node detail element | ||
/// i.e {"123DE": "aarch64"} | ||
node_map: HashMap<ArrayString<64>,K> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reasoning behind adding this?
As far as I understand, the relevant properties are exposed in NodeDetails
, and then they are sent to the UI already (some depending on --expose-node-details
). So I wonder whether you can avoid modifying all of this chain stats/counter/ranking stuff? Offhand I can't see it being used anywhere in the frontend changes.
Overall I'm happy to expose node system info for each node. Whether or not it should only be when There are also changes to the |
Hey @jsdw thank you for the reviews!!! Yeah actually we first tried mapping each node ID to the extra set of details needed (cpu, cpuarch etc), that was before we had understood the entire codebase and the specific payloads !!! :) Yeah in hindsight I should have just scraped off those changes and left the latest ones. Let me do just that and get back to you! ^^ |
That sounds great to me; thank you! |
Hey @jsdw I have made the changes requested! ^^ |
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit; remove extra lines
backend/common/src/node_types.rs
Outdated
@@ -38,7 +38,7 @@ pub struct NodeDetails { | |||
pub validator: Option<Box<str>>, | |||
pub network_id: NetworkId, | |||
pub startup_time: Option<Box<str>>, | |||
pub target_os: Option<Box<str>>, | |||
pub target_os: Option<Box<str>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: remove unnecessary space?
pub target_os: Option<Box<str>>, | |
pub target_os: Option<Box<str>>, |
@@ -16,7 +16,6 @@ | |||
|
|||
use super::counter::{Counter, CounterValue}; | |||
use crate::feed_message::ChainStats; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add back newline between imports and constants?
|
||
#[derive(Serialize)] | ||
pub struct ChainStatsUpdate<'a>(pub &'a ChainStats); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Unnecessary newlines?
#[derive(Serialize)] | |
pub struct ChainStatsUpdate<'a>(pub &'a ChainStats); | |
#[derive(Serialize)] | |
pub struct ChainStatsUpdate<'a>(pub &'a ChainStats); | |
@@ -162,10 +161,10 @@ impl ChainStatsCollator { | |||
self.version.modify(Some(&*details.version), op); | |||
|
|||
self.target_os | |||
.modify(details.target_os.as_ref().map(|value| &**value), op); | |||
.modify(details.target_os.as_ref().map(|value| &**value), op); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.modify(details.target_os.as_ref().map(|value| &**value), op); | |
.modify(details.target_os.as_ref().map(|value| &**value), op); |
|
||
self.target_arch | ||
.modify(details.target_arch.as_ref().map(|value| &**value), op); | ||
.modify(details.target_arch.as_ref().map(|value| &**value), op); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.modify(details.target_arch.as_ref().map(|value| &**value), op); | |
.modify(details.target_arch.as_ref().map(|value| &**value), op); |
@@ -179,7 +178,7 @@ impl ChainStatsCollator { | |||
self.memory.modify(memory.as_ref(), op); | |||
|
|||
self.core_count | |||
.modify(sysinfo.and_then(|sysinfo| sysinfo.core_count.as_ref()), op); | |||
.modify(sysinfo.and_then(|sysinfo| sysinfo.core_count.as_ref()), op); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.modify(sysinfo.and_then(|sysinfo| sysinfo.core_count.as_ref()), op); | |
.modify(sysinfo.and_then(|sysinfo| sysinfo.core_count.as_ref()), op); |
Thanks! I haven't looked through it all yet but would run |
Hey @jsdw apologies I was held up abit. So I've formatted both frontend and backend, what's left is actually some e2e tests which are failing:
Upon quick introspection I can see its because there's a mismatch between the expected and actual data structure when decoding the JSON message, since we altered it to fit the new inputs. The solution would be to update the tests to handle this new structure, but otherwise it would be great to hear your opinion on this! Thanks :) |
Hey @CyndieKamau, no worries! Having a quick look at the tests, I think it's just that this enum needs updating to match the feed message updates you did:
(I can't remember why it's a separate struct now, but hopefully it's pretty straightforward to tweak to match the new expected structure!) |
Added new item in Ranking node_map, mapping node id to node detail Co-authored-by: Cyndie Kamau <[email protected]>
@jsdw fixed it, ready to be merged |
@jsdw any pendings that needs to be addressed for the PR to be merged? |
Hey! I'll have to have another proper look over the code, but great to see the tests passing now, nice one! I do see a |
removed it |
I opened #591 to address a few nits with this. Feel free to merge that into here (I can't easily do this) or we can continue from there! One thing I noticed is that when I run a |
#591 is merged so closing this one, thanks |
Hello, this PR is focused on providing a more detailed view of node metrics on the telemetry platform, by mapping the extra node info aggregated as a summary in
ChainStats
to specific nodes in the nodes' list table.Some of the key changes implemented include:
Backend
NodeDetails
struct to include the extra information (target_os
,target_arch
,target_env
,sysinfo
) incommon/src/node_types.rs
AddedNode
payload to always expose thesysinfo
details by default to get the additional stats (cpu
,memory
,core_count
,linux_kernel
,linux_distro
,is_virtual_machine
) found inNodeSysInfo
Frontend
Node
constructor to handle the extra details withinNodeDetails
The objective is to provide telemetry users with deeper insights into the operational aspects of nodes. By exposing more detailed system information, users can better understand and track node operations.