|
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; |
2 | 4 |
|
3 | 5 | #[derive(Debug, Default)] |
4 | 6 | pub(crate) struct NotificationMetrics { |
@@ -63,16 +65,36 @@ impl EpochMetrics { |
63 | 65 | datapoint_info!(name, ("count", count, i64), ("epoch", self.epoch, i64),); |
64 | 66 | } |
65 | 67 |
|
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, |
72 | 81 | ); |
73 | 82 | } |
74 | 83 | } |
75 | 84 |
|
| 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 | + |
76 | 98 | pub fn increment_tx_count(&mut self) { |
77 | 99 | self.tx += 1; |
78 | 100 | self.emit_live_metric("jito-bell-transactions", 1); |
|
0 commit comments