Skip to content

Commit 35f3d31

Browse files
committed
feat(metrics): log epoch progress summary every 1/10 of an epoch
1 parent 2b2ac38 commit 35f3d31

2 files changed

Lines changed: 30 additions & 7 deletions

File tree

jito-bell/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ impl JitoBellHandler {
190190
let current_epoch = slot / DEFAULT_SLOTS_PER_EPOCH;
191191
self.epoch_metrics.update_slot(slot);
192192
self.epoch_metrics.emit_slot_heartbeat(slot);
193+
self.epoch_metrics.emit_epoch_progress(slot);
193194
if current_epoch != self.epoch_metrics.epoch {
194195
datapoint_info!(
195196
"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)