Skip to content

Commit ef9e7f2

Browse files
committed
more metrics
1 parent 1c2bad0 commit ef9e7f2

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

crates/tpu-client/src/core.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,6 +1653,7 @@ where
16531653
if debug_source == SpawnSource::NewTransaction {
16541654
prom::incr_quic_gw_tx_connection_cache_hit_cnt();
16551655
}
1656+
prom::incr_fast_txn_worker_install_path();
16561657
}
16571658
self.install_worker(remote_peer_identity, remote_peer_addr);
16581659
return;
@@ -2811,7 +2812,7 @@ where
28112812
Some(oldest + self.config.orphan_connection_ttl)
28122813
}
28132814

2814-
fn try_evict_unused_connections(&mut self) {
2815+
fn try_evict_orphan_connections(&mut self) {
28152816
let now = Instant::now();
28162817
loop {
28172818
let Some(oldest) = self.orphan_connection_set.oldest() else {
@@ -2861,6 +2862,10 @@ where
28612862
active_conn.conn.close(VarInt::from_u32(0), &[0u8]);
28622863
drop(active_conn);
28632864
self.unblock_eviction_waiting_connection();
2865+
#[cfg(feature = "prometheus")]
2866+
{
2867+
prom::incr_evicted_orphan_connections();
2868+
}
28642869
}
28652870
}
28662871
}
@@ -2914,7 +2919,7 @@ where
29142919
}
29152920
}
29162921
_ = async { sleep_timer.as_mut().unwrap().await }, if sleep_timer.is_some() => {
2917-
self.try_evict_unused_connections();
2922+
self.try_evict_orphan_connections();
29182923
}
29192924
// If cnc_rx returns None, we don't care as clients can safely drop cnc sender and the runtime should keep function.
29202925
Some(command) = self.cnc_rx.recv() => {

crates/tpu-client/src/prom.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,24 @@ lazy_static::lazy_static! {
158158
"jet_tpu_client_orphan_connections",
159159
"Number of orphan connections (no sender tasks referencing them)"
160160
).unwrap();
161+
162+
static ref EVICTED_ORPHAN_CONNECTIONS: IntCounter = IntCounter::new(
163+
"jet_tpu_client_evicted_orphan_connections",
164+
"Number of evicted orphan connections"
165+
).unwrap();
166+
167+
static ref FAST_TXN_WORKER_INSTALL_PATH: IntCounter = IntCounter::new(
168+
"jet_tpu_client_fast_txn_worker_install_path",
169+
"Number of times the fast path was taken to install a transaction worker"
170+
).unwrap();
171+
}
172+
173+
pub fn incr_evicted_orphan_connections() {
174+
EVICTED_ORPHAN_CONNECTIONS.inc();
175+
}
176+
177+
pub fn incr_fast_txn_worker_install_path() {
178+
FAST_TXN_WORKER_INSTALL_PATH.inc();
161179
}
162180

163181
pub fn set_orphan_connections(count: usize) {
@@ -315,6 +333,10 @@ pub fn register_metrics(reg: &Registry) {
315333
reg.register(Box::new(INVALID_TXN_PACKET_SIZE.clone()))
316334
.unwrap();
317335
reg.register(Box::new(ORPHAN_CONNECTIONS.clone())).unwrap();
336+
reg.register(Box::new(FAST_TXN_WORKER_INSTALL_PATH.clone()))
337+
.unwrap();
338+
reg.register(Box::new(EVICTED_ORPHAN_CONNECTIONS.clone()))
339+
.unwrap();
318340
}
319341

320342
pub fn inc_quic_gw_unreachable_peer_count(leader: Pubkey) {

0 commit comments

Comments
 (0)