Expose GitHub hash in UI (#604)

* Expose GitHub hash in UI

* Prettier:fix

* cargo fmt

* Update tests

* Fix test
This commit is contained in:
James Wilson
2025-08-28 18:05:46 +01:00
committed by GitHub
parent 4a5cd54cd8
commit 71744ade7c
16 changed files with 115 additions and 33 deletions
@@ -451,7 +451,10 @@ impl InnerLoop {
// Tell the new feed subscription some basic things to get it going:
let mut feed_serializer = FeedMessageSerializer::new();
feed_serializer.push(feed_message::Version(32));
feed_serializer.push(feed_message::Version(crate::feed_message::FEED_VERSION));
feed_serializer.push(feed_message::TelemetryInfo {
git_hash: crate::GIT_HASH,
});
for chain in self.node_state.iter_chains() {
feed_serializer.push(feed_message::AddedChain(
chain.label(),
@@ -25,6 +25,10 @@ use common::node_types::{
};
use serde_json::to_writer;
/// The version of the feed messages. This should be incremented
/// on the backend and frontend when the feed API changes.
pub const FEED_VERSION: usize = 33;
type FeedNodeId = usize;
pub trait FeedMessage {
@@ -123,6 +127,7 @@ actions! {
20: StaleNode,
21: NodeIOUpdate<'_>,
22: ChainStatsUpdate<'_>,
23: TelemetryInfo,
}
#[derive(Serialize)]
@@ -252,3 +257,8 @@ pub struct ChainStats {
pub disk_random_write_score: Ranking<(u32, Option<u32>)>,
pub cpu_vendor: Ranking<String>,
}
#[derive(Serialize)]
pub struct TelemetryInfo {
pub git_hash: &'static str,
}
+1
View File
@@ -41,6 +41,7 @@ use jemallocator::Jemalloc;
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;
const GIT_HASH: &str = env!("GIT_HASH");
const VERSION: &str = env!("CARGO_PKG_VERSION");
const AUTHORS: &str = env!("CARGO_PKG_AUTHORS");
const NAME: &str = "Substrate Telemetry Backend Core";