mirror of
https://github.com/logos-co/nomos-simulations.git
synced 2025-01-09 18:25:54 +00:00
enrich monitors log
This commit is contained in:
parent
6ca609acd9
commit
1662a659e9
@ -315,13 +315,15 @@ impl MixNode {
|
|||||||
tracing::info!("Emission: {}", serde_json::to_string(log).unwrap());
|
tracing::info!("Emission: {}", serde_json::to_string(log).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn log_monitor(&self, effective_messages_series: &Series) {
|
fn log_monitors(&self, effective_messages_series: &Series) {
|
||||||
if effective_messages_series.is_empty() {
|
if effective_messages_series.is_empty() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let log = SeriesLog {
|
let log = MonitorsLog {
|
||||||
series_type: "EffectiveMessages".to_string(),
|
node_id: self.id.index(),
|
||||||
|
message_type: "EffectiveMessage".to_string(),
|
||||||
|
num_conns: effective_messages_series.len(),
|
||||||
min: effective_messages_series.min().unwrap().unwrap(),
|
min: effective_messages_series.min().unwrap().unwrap(),
|
||||||
avg: effective_messages_series.mean().unwrap(),
|
avg: effective_messages_series.mean().unwrap(),
|
||||||
median: effective_messages_series.median().unwrap(),
|
median: effective_messages_series.median().unwrap(),
|
||||||
@ -378,7 +380,7 @@ impl Node for MixNode {
|
|||||||
.values()
|
.values()
|
||||||
.map(|monitor| monitor.effective_messages as u64),
|
.map(|monitor| monitor.effective_messages as u64),
|
||||||
);
|
);
|
||||||
self.log_monitor(&effective_messages_series);
|
self.log_monitors(&effective_messages_series);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle incoming messages
|
// Handle incoming messages
|
||||||
@ -459,8 +461,10 @@ struct EmissionLog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
struct SeriesLog {
|
struct MonitorsLog {
|
||||||
series_type: String,
|
node_id: usize,
|
||||||
|
message_type: String,
|
||||||
|
num_conns: usize,
|
||||||
min: u64,
|
min: u64,
|
||||||
avg: f64,
|
avg: f64,
|
||||||
median: f64,
|
median: f64,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user