Skip to content

Commit 3358ba8

Browse files
authored
Additional transaction metrics. (#40)
1 parent ac1f8ea commit 3358ba8

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

crates/plugin/src/metrics.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ pub struct Metrics {
4545
pub acct_sends: Counter,
4646
pub acct_recvs: Counter,
4747
pub ins_sends: Counter,
48+
pub txn_sends: Counter,
4849
pub txn_recvs: Counter,
50+
pub txn_errs: Counter,
4951
pub status_sends: Counter,
5052
pub status_recvs: Counter,
5153
pub errs: Counter,
@@ -58,7 +60,9 @@ impl Metrics {
5860
acct_sends: Counter::new("geyser_acct_sends", Level::Info),
5961
acct_recvs: Counter::new("geyser_acct_recvs", Level::Info),
6062
ins_sends: Counter::new("geyser_ins_sends", Level::Info),
63+
txn_sends: Counter::new("geyser_txn_sends", Level::Info),
6164
txn_recvs: Counter::new("geyser_txn_recvs", Level::Info),
65+
txn_errs: Counter::new("geyser_txn_errs", Level::Info),
6266
status_sends: Counter::new("geyser_status_sends", Level::Info),
6367
status_recvs: Counter::new("geyser_status_recvs", Level::Info),
6468
errs: Counter::new("geyser_errs", Level::Error),

crates/plugin/src/plugin.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,19 +346,21 @@ impl GeyserPlugin for GeyserPluginRabbitMq {
346346
return Ok(());
347347
}
348348

349-
this.metrics.txn_recvs.log(1);
350-
351349
match transaction {
352350
ReplicaTransactionInfoVersions::V0_0_1(tx) => {
353351
if matches!(tx.transaction_status_meta.status, Err(..)) {
352+
this.metrics.txn_errs.log(1);
354353
return Ok(());
355354
}
356355

356+
this.metrics.txn_recvs.log(1);
357+
357358
let msg = tx.transaction.message();
358359
let keys = msg.account_keys();
359360

360361
let txn_signature = tx.signature.as_ref();
361362

363+
let mut any_sent = false;
362364
for ins in msg
363365
.instructions()
364366
.iter()
@@ -384,6 +386,7 @@ impl GeyserPlugin for GeyserPluginRabbitMq {
384386
txn_signature,
385387
) {
386388
Ok(Some(m)) => {
389+
any_sent = true;
387390
this.spawn(|this| async move {
388391
this.producer.send(m).await;
389392
this.metrics.ins_sends.log(1);
@@ -398,6 +401,10 @@ impl GeyserPlugin for GeyserPluginRabbitMq {
398401
},
399402
}
400403
}
404+
405+
if any_sent {
406+
this.metrics.txn_sends.log(1);
407+
}
401408
},
402409
}
403410

0 commit comments

Comments
 (0)