diff --git a/crates/plugin/src/metrics.rs b/crates/plugin/src/metrics.rs index 2cacc92..6078f88 100644 --- a/crates/plugin/src/metrics.rs +++ b/crates/plugin/src/metrics.rs @@ -45,7 +45,9 @@ pub struct Metrics { pub acct_sends: Counter, pub acct_recvs: Counter, pub ins_sends: Counter, + pub txn_sends: Counter, pub txn_recvs: Counter, + pub txn_errs: Counter, pub status_sends: Counter, pub status_recvs: Counter, pub errs: Counter, @@ -58,7 +60,9 @@ impl Metrics { acct_sends: Counter::new("geyser_acct_sends", Level::Info), acct_recvs: Counter::new("geyser_acct_recvs", Level::Info), ins_sends: Counter::new("geyser_ins_sends", Level::Info), + txn_sends: Counter::new("geyser_txn_sends", Level::Info), txn_recvs: Counter::new("geyser_txn_recvs", Level::Info), + txn_errs: Counter::new("geyser_txn_errs", Level::Info), status_sends: Counter::new("geyser_status_sends", Level::Info), status_recvs: Counter::new("geyser_status_recvs", Level::Info), errs: Counter::new("geyser_errs", Level::Error), diff --git a/crates/plugin/src/plugin.rs b/crates/plugin/src/plugin.rs index 12933ed..592ab60 100644 --- a/crates/plugin/src/plugin.rs +++ b/crates/plugin/src/plugin.rs @@ -346,19 +346,21 @@ impl GeyserPlugin for GeyserPluginRabbitMq { return Ok(()); } - this.metrics.txn_recvs.log(1); - match transaction { ReplicaTransactionInfoVersions::V0_0_1(tx) => { if matches!(tx.transaction_status_meta.status, Err(..)) { + this.metrics.txn_errs.log(1); return Ok(()); } + this.metrics.txn_recvs.log(1); + let msg = tx.transaction.message(); let keys = msg.account_keys(); let txn_signature = tx.signature.as_ref(); + let mut any_sent = false; for ins in msg .instructions() .iter() @@ -384,6 +386,7 @@ impl GeyserPlugin for GeyserPluginRabbitMq { txn_signature, ) { Ok(Some(m)) => { + any_sent = true; this.spawn(|this| async move { this.producer.send(m).await; this.metrics.ins_sends.log(1); @@ -398,6 +401,10 @@ impl GeyserPlugin for GeyserPluginRabbitMq { }, } } + + if any_sent { + this.metrics.txn_sends.log(1); + } }, }