Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Grumbles.
  • Loading branch information
gavofyork committed Jul 12, 2018
commit 36f55fb5e5beccff4d77097e5fe9a468256fd464
7 changes: 6 additions & 1 deletion substrate/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@ impl<B, E, Block> Client<B, E, Block> where
*self.importing_block.write() = Some(hash);
let result = self.execute_and_import_block(origin, hash, header, justification, body);
*self.importing_block.write() = None;
telemetry!("block.import";
"height" => { let n: u64 = header.number().as_(); n },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't:

"height" => header.number().as_::<u64>(),

work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no - as_ doesn't take a generic param: the trait does.

"best" => ?hash,
"is_new_best" => is_new_best,
"origin" => ?origin
);
result
}

Expand Down Expand Up @@ -335,7 +341,6 @@ impl<B, E, Block> Client<B, E, Block> where

let is_new_best = header.number() == &(self.backend.blockchain().info()?.best_number + One::one());
trace!("Imported {}, (#{}), best={}, origin={:?}", hash, header.number(), is_new_best, origin);
telemetry!("block.import"; "height" => { let n: u64 = header.number().as_(); n }, "best" => ?hash, "is_new_best" => is_new_best, "origin" => ?origin);
let unchecked: bft::UncheckedJustification<_> = justification.uncheck().into();
transaction.set_block_data(header.clone(), body, Some(unchecked.into()), is_new_best)?;
if let Some(storage_update) = storage_update {
Expand Down
5 changes: 4 additions & 1 deletion substrate/telemetry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ pub struct TelemetryConfig {
pub on_connect: Box<Fn() + Send + 'static>,
}

/// Size of the channel for passing messages to telemetry thread.
const CHANNEL_SIZE: usize = 262144;

/// Initialise telemetry.
pub fn init_telemetry(config: TelemetryConfig) -> slog_scope::GlobalLoggerGuard {
let log = slog::Logger::root(
Expand All @@ -58,7 +61,7 @@ pub fn init_telemetry(config: TelemetryConfig) -> slog_scope::GlobalLoggerGuard
first_time: true, // ensures that on_connect will be called.
}
).fuse()
).chan_size(262144).overflow_strategy(slog_async::OverflowStrategy::DropAndReport).build().fuse(), o!()
).chan_size(CHANNEL_SIZE).overflow_strategy(slog_async::OverflowStrategy::DropAndReport).build().fuse(), o!()
);
slog_scope::set_global_logger(log)
}
Expand Down