mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 16:21:02 +00:00
Telemetry (Slog + WS) (#217)
* Merge remote-tracking branch 'origin/master' into gav-xts-dont-panic * Update wasm. * consensus, session and staking all panic-safe. * Democracy doesn't panic in apply. * Fix tests. * Extra helper macro, council depanicked. * Fix one test. * Fix up all council tests. No panics! * Council voting depanicked. * Dispatch returns result. * session & staking tests updated * Fix democracy tests. * Fix council tests. * Fix up polkadot parachains in runtime * Fix borked merge * More Slicable support Support general `Option` and array types. * Basic storage types. * Existential deposit for contract creation * Basic implemnetation along with removals * Fix tests. * externalities builder fix. * Tests. * Fix up the runtime. * Fix tests. * Add generic `Address` type. * Initial function integration of Address into Extrinsic. * Fix build * All tests compile. * Fix (some) tests. * Fix signing. * Push error. * transfer can accept Address * Make Address generic over AccountIndex * Fix test * Make Council use Address for dispatch. * Fix build * Bend over backwards to support braindead derive. * Repot some files. * Fix tests. * Fix grumbles * Remove Default bound * Fix build for new nightly. * Make `apply_extrinsic` never panic, return useful Result. * More merge hell * Doesn't build, but might do soon * Serde woes * get substrate-runtime-staking compiling * Polkadot builds again! * Fix all build. * Fix tests & binaries. * Reserve some extra initial byte values of address for future format changes * Make semantic of `ReservedBalance` clear. * Fix panic handler. * Integrate other balance transformations into the new model Fix up staking tests. * Fix runtime tests. * Fix panic build. * Tests for demonstrating interaction between balance types. * Repot some runtime code * Fix checkedblock in non-std builds * Get rid of `DoLookup` phantom. * Attempt to make transaction_pool work with lookups. * Remove vscode settings * New attempt at making transaction pool work. * It builds again! * --all builds * Fix tests. * New build. * Test account nonce reset. * polkadot transaction pool tests/framework. * Initial draft (working). * Address grumbles. * Revert bad `map_or` * Rebuild binaries, workaround. * Avoid checking in vscode * reconnecting, shared, slog * CLI options for name and telemetry url * ensure telemetry url imples enabled * Avoid casting to usize early. * Provide on-connect event for session message * Better port * heartbeat and some renaming * transaction pool stuff * minor renaming. * report telemetry * cleanups. * Fix for previous cleanup * Initial draft (working). * Avoid checking in vscode * reconnecting, shared, slog * CLI options for name and telemetry url * ensure telemetry url imples enabled * Provide on-connect event for session message * Better port * heartbeat and some renaming * transaction pool stuff * minor renaming. * report telemetry * cleanups. * Fix for previous cleanup * Address grumble * Final grumble and repot telemetry to substrate * Fix comment * Please build, travis...
This commit is contained in:
@@ -39,18 +39,22 @@ pub fn start<B, E>(service: &Service<B, E>, handle: reactor::Handle)
|
||||
|
||||
let network = service.network();
|
||||
let client = service.client();
|
||||
let txpool = service.transaction_pool();
|
||||
|
||||
let display_notifications = interval.map_err(|e| debug!("Timer error: {:?}", e)).for_each(move |_| {
|
||||
let sync_status = network.status();
|
||||
|
||||
if let Ok(best_block) = client.best_block_header() {
|
||||
let hash = best_block.hash();
|
||||
let num_peers = sync_status.num_peers;
|
||||
let status = match (sync_status.sync.state, sync_status.sync.best_seen_block) {
|
||||
(SyncState::Idle, _) => "Idle".into(),
|
||||
(SyncState::Downloading, None) => "Syncing".into(),
|
||||
(SyncState::Downloading, Some(n)) => format!("Syncing, target=#{}", n),
|
||||
};
|
||||
info!(target: "polkadot", "{} ({} peers), best: #{} ({})", status, sync_status.num_peers, best_block.number, hash)
|
||||
let txpool_status = txpool.light_status();
|
||||
info!(target: "polkadot", "{} ({} peers), best: #{} ({})", status, sync_status.num_peers, best_block.number, hash);
|
||||
telemetry!("system.interval"; "status" => status, "peers" => num_peers, "height" => best_block.number, "best" => ?hash, "txcount" => txpool_status.transaction_count);
|
||||
} else {
|
||||
warn!("Error getting best block information");
|
||||
}
|
||||
@@ -60,10 +64,18 @@ pub fn start<B, E>(service: &Service<B, E>, handle: reactor::Handle)
|
||||
let client = service.client();
|
||||
let display_block_import = client.import_notification_stream().for_each(|n| {
|
||||
info!(target: "polkadot", "Imported #{} ({})", n.header.number, n.hash);
|
||||
telemetry!("block.import"; "height" => n.header.number, "best" => ?n.hash);
|
||||
Ok(())
|
||||
});
|
||||
|
||||
let txpool = service.transaction_pool();
|
||||
let display_txpool_import = txpool.import_notification_stream().for_each(move |_| {
|
||||
let status = txpool.light_status();
|
||||
telemetry!("txpool.import"; "mem_usage" => status.mem_usage, "count" => status.transaction_count, "sender" => status.senders);
|
||||
Ok(())
|
||||
});
|
||||
handle.spawn(display_notifications);
|
||||
handle.spawn(display_block_import);
|
||||
handle.spawn(display_txpool_import);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user