Skip to content

Commit e6fb16f

Browse files
authored
Logging Fixes (#151)
- Remove duplicate slot logic due to ancient version of yellowstone-client-crate - Remove info logging every 10 slots -- make it debug instead - Only send metrics every 100 slots instead of 10 slots - Add an `info` with stats every 1/10 of an epoch
1 parent efe9c72 commit e6fb16f

2 files changed

Lines changed: 35 additions & 8 deletions

File tree

jito-bell/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ impl JitoBellHandler {
104104
match message {
105105
Ok(msg) => match msg.update_oneof {
106106
Some(UpdateOneof::Slot(update_slot)) => {
107-
self.handle_slot_update(update_slot.slot);
107+
// Newer geyser servers leak interslot SlotStatuses that v2.0.0 protos
108+
// decode with garbage status; dedupe by accepting only our commitment.
109+
if update_slot.status == self.subscribe_option.commitment as i32 {
110+
self.handle_slot_update(update_slot.slot);
111+
}
108112
}
109113
Some(UpdateOneof::Transaction(transaction)) => {
110114
// A parser is a list of instructions + events from the transaction that
@@ -186,6 +190,7 @@ impl JitoBellHandler {
186190
let current_epoch = slot / DEFAULT_SLOTS_PER_EPOCH;
187191
self.epoch_metrics.update_slot(slot);
188192
self.epoch_metrics.emit_slot_heartbeat(slot);
193+
self.epoch_metrics.emit_epoch_progress(slot);
189194
if current_epoch != self.epoch_metrics.epoch {
190195
datapoint_info!(
191196
"jito-bell-epoch",

jito-bell/src/metrics.rs

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use solana_metrics::datapoint_info;
1+
use log::info;
2+
use solana_metrics::{datapoint::DataPoint, datapoint_info, submit};
3+
use solana_sdk::clock::DEFAULT_SLOTS_PER_EPOCH;
24

35
#[derive(Debug, Default)]
46
pub(crate) struct NotificationMetrics {
@@ -63,16 +65,36 @@ impl EpochMetrics {
6365
datapoint_info!(name, ("count", count, i64), ("epoch", self.epoch, i64),);
6466
}
6567

66-
pub fn emit_slot_heartbeat(&self, slot: u64) {
67-
if slot.is_multiple_of(10) {
68-
datapoint_info!(
69-
"jito-bell-slot-heartbeat",
70-
("slot", slot, i64),
71-
("epoch", self.epoch, i64),
68+
pub fn emit_epoch_progress(&self, slot: u64) {
69+
if slot.is_multiple_of(DEFAULT_SLOTS_PER_EPOCH / 10) {
70+
let position = slot % DEFAULT_SLOTS_PER_EPOCH;
71+
info!(
72+
"epoch={} slot={} ({position}/{}) tx={} failed_tx={} notif_ok={} notif_fail={} squads_parsed={}",
73+
self.epoch,
74+
slot,
75+
DEFAULT_SLOTS_PER_EPOCH,
76+
self.tx,
77+
self.failed_tx,
78+
self.notification.success,
79+
self.notification.fail,
80+
self.squads.proposals_parsed,
7281
);
7382
}
7483
}
7584

85+
pub fn emit_slot_heartbeat(&self, slot: u64) {
86+
if slot.is_multiple_of(100) {
87+
// Manual datapoint construction (vs. datapoint_info!): we want the point
88+
// submitted to InfluxDB unconditionally, with only the agent's per-point
89+
// log line filtered out by RUST_LOG. datapoint_debug! would gate the
90+
// submit on log_enabled!(Debug), dropping the metric at default verbosity.
91+
let mut point = DataPoint::new("jito-bell-slot-heartbeat");
92+
point.add_field_i64("slot", slot as i64);
93+
point.add_field_i64("epoch", self.epoch as i64);
94+
submit(point, log::Level::Debug);
95+
}
96+
}
97+
7698
pub fn increment_tx_count(&mut self) {
7799
self.tx += 1;
78100
self.emit_live_metric("jito-bell-transactions", 1);

0 commit comments

Comments
 (0)