In order to propagate performance information into an hbbft caller, add an event_log to Steps definition. Events will implement failure::Fault, simply because it is a convenient interface for defining event types as well as annotating them formatted Display messages.
By including event_log in Step, logs will be naturally extended across calls and provided to the initial caller.
EventLog has a similar signature to FaultLog
pub struct `EventLog(pub Vec<Event>);
Events are similar to the Fault struct, but instead of node_id, they record a timestamp:
pub struct Event<L: Fail> {
logtime: std::time::Instant,
content: L
};
This way, the caller can record duration between two events using std::time::Instant::duration_since. Instants are monotonically increasing. They can be mapped to system time by logging a message who's contents is current OS system time. This way both clocks can be synchronized.
Besides measuring performance, event logs can be used by hbbft calling applications to detect soft failures, like a validator going off line, by collecting and monitoring logs over time.
If EventLog is added, a nice use case would be to add event logs to DistAlgorithm calls. So, the first time foo.handle_message is called it issues a log event, and when foo.handle_output produces an output a log event is also issued. Comparing this data between runs can be used to benchmark performance.
In order to propagate performance information into an hbbft caller, add an
event_log
toStep
s definition. Events will implementfailure::Fault
, simply because it is a convenient interface for defining event types as well as annotating them formatted Display messages.By including event_log in
Step
, logs will be naturally extended across calls and provided to the initial caller.EventLog has a similar signature to
FaultLog
Events are similar to the
Fault
struct, but instead of node_id, they record a timestamp:This way, the caller can record duration between two events using
std::time::Instant::duration_since
.Instants
are monotonically increasing. They can be mapped to system time by logging a message who's contents is current OS system time. This way both clocks can be synchronized.Besides measuring performance, event logs can be used by hbbft calling applications to detect soft failures, like a validator going off line, by collecting and monitoring logs over time.
If EventLog is added, a nice use case would be to add event logs to DistAlgorithm calls. So, the first time
foo.handle_message
is called it issues a log event, and whenfoo.handle_output
produces an output a log event is also issued. Comparing this data between runs can be used to benchmark performance.