diff --git a/crates/ingress-rpc/src/metrics.rs b/crates/ingress-rpc/src/metrics.rs index 1b7c8a5..c899b56 100644 --- a/crates/ingress-rpc/src/metrics.rs +++ b/crates/ingress-rpc/src/metrics.rs @@ -18,6 +18,24 @@ pub fn record_histogram(rpc_latency: Duration, rpc: String) { #[derive(Metrics, Clone)] #[metrics(scope = "tips_ingress_rpc")] pub struct Metrics { + #[metric(describe = "Number of valid transactions received")] + pub transactions_received: Counter, + + #[metric(describe = "Number of valid bundles parsed")] + pub bundles_parsed: Counter, + + #[metric(describe = "Number of bundles simulated")] + pub successful_simulations: Counter, + + #[metric(describe = "Number of bundles simulated")] + pub failed_simulations: Counter, + + #[metric(describe = "Number of bundles sent to kafka")] + pub sent_to_kafka: Counter, + + #[metric(describe = "Number of transactions sent to mempool")] + pub sent_to_mempool: Counter, + #[metric(describe = "Duration of validate_tx")] pub validate_tx_duration: Histogram, diff --git a/crates/ingress-rpc/src/service.rs b/crates/ingress-rpc/src/service.rs index 1a2f9d0..b54994c 100644 --- a/crates/ingress-rpc/src/service.rs +++ b/crates/ingress-rpc/src/service.rs @@ -202,6 +202,8 @@ impl IngressApiServer for IngressService { let start = Instant::now(); let transaction = self.get_tx(&data).await?; + self.metrics.transactions_received.increment(1); + let send_to_kafka = matches!( self.tx_submission_method, TxSubmissionMethod::Kafka | TxSubmissionMethod::MempoolAndKafka @@ -223,6 +225,7 @@ impl IngressApiServer for IngressService { reverting_tx_hashes: vec![transaction.tx_hash()], ..Default::default() }; + let parsed_bundle: ParsedBundle = bundle .clone() .try_into() @@ -230,10 +233,15 @@ impl IngressApiServer for IngressService { let bundle_hash = &parsed_bundle.bundle_hash(); + self.metrics.bundles_parsed.increment(1); + let meter_bundle_response = self.meter_bundle(&bundle, bundle_hash).await.ok(); if let Some(meter_info) = meter_bundle_response.as_ref() { + self.metrics.successful_simulations.increment(1); _ = self.builder_tx.send(meter_info.clone()); + } else { + self.metrics.failed_simulations.increment(1); } let accepted_bundle = @@ -248,6 +256,7 @@ impl IngressApiServer for IngressService { warn!(message = "Failed to publish Queue::enqueue_bundle", bundle_hash = %bundle_hash, error = %e); } + self.metrics.sent_to_kafka.increment(1); info!(message="queued singleton bundle", txn_hash=%transaction.tx_hash()); } @@ -258,6 +267,7 @@ impl IngressApiServer for IngressService { .await; match response { Ok(_) => { + self.metrics.sent_to_mempool.increment(1); debug!(message = "sent transaction to the mempool", hash=%transaction.tx_hash()); } Err(e) => { @@ -285,7 +295,7 @@ impl IngressApiServer for IngressService { }); } - debug!( + info!( message = "processed transaction", bundle_hash = %bundle_hash, transaction_hash = %transaction.tx_hash(), diff --git a/ui/src/lib/s3.ts b/ui/src/lib/s3.ts index 229fdad..4b0263a 100644 --- a/ui/src/lib/s3.ts +++ b/ui/src/lib/s3.ts @@ -60,7 +60,6 @@ async function getObjectContent(key: string): Promise { const body = await response.Body?.transformToString(); return body || null; } catch (error) { - console.error(`Failed to get S3 object ${key}:`, error); return null; } }