From fde64fbcbc6dd21cb2ca587e358655605e6d5fc1 Mon Sep 17 00:00:00 2001 From: Nikhil Acharya <128666399+nikhil-helius@users.noreply.github.com> Date: Fri, 14 Jul 2023 09:40:55 +0530 Subject: [PATCH] Revert "Revert "Das: Log account publickey (#87)" (#88)" (#92) This reverts commit 8cf6b2149f9625ce41bfb9c0bec6d64300d4a0aa. --- nft_ingester/src/account_updates.rs | 12 +++++++----- nft_ingester/src/metrics.rs | 9 ++++++++- nft_ingester/src/transaction_notifications.rs | 1 + 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/nft_ingester/src/account_updates.rs b/nft_ingester/src/account_updates.rs index fd94b4aad..52f1b4f5a 100644 --- a/nft_ingester/src/account_updates.rs +++ b/nft_ingester/src/account_updates.rs @@ -1,10 +1,7 @@ -use std::{ - sync::Arc, -}; +use std::sync::Arc; use crate::{ - metric, metrics::capture_result, - program_transformers::ProgramTransformer, tasks::TaskData, + metric, metrics::capture_result, program_transformers::ProgramTransformer, tasks::TaskData, }; use cadence_macros::{is_global_default_set, statsd_count, statsd_time}; use chrono::Utc; @@ -91,6 +88,10 @@ async fn handle_account(manager: Arc, item: RecvData) -> Opt "stream" => ACCOUNT_STREAM ); } + let mut account = None; + if let Some(pubkey) = account_update.pubkey() { + account = Some(bs58::encode(pubkey.0.as_slice()).into_string()); + } let begin_processing = Instant::now(); let res = manager.handle_account_update(account_update).await; ret_id = capture_result( @@ -101,6 +102,7 @@ async fn handle_account(manager: Arc, item: RecvData) -> Opt res, begin_processing, None, + account, ); } ret_id diff --git a/nft_ingester/src/metrics.rs b/nft_ingester/src/metrics.rs index df7cf70d2..4bd83c485 100644 --- a/nft_ingester/src/metrics.rs +++ b/nft_ingester/src/metrics.rs @@ -48,6 +48,7 @@ pub fn capture_result( res: Result<(), IngesterError>, proc: Instant, txn_sig: Option<&str>, + account: Option, ) -> Option { let mut ret_id = None; match res { @@ -78,6 +79,8 @@ pub fn capture_result( } if let Some(sig) = txn_sig { warn!("Error deserializing txn {}: {:?}", sig, e); + } else if let Some(account) = account { + warn!("Error deserializing account {}: {:?}", account, e); } else { warn!("{}", e); } @@ -89,6 +92,8 @@ pub fn capture_result( } if let Some(sig) = txn_sig { warn!("Error parsing txn {}: {:?}", sig, e); + } else if let Some(account) = account { + warn!("Error parsing account {}: {:?}", account, e); } else { warn!("{}", e); } @@ -97,8 +102,10 @@ pub fn capture_result( Err(err) => { if let Some(sig) = txn_sig { error!("Error handling update for txn {}: {:?}", sig, err); + } else if let Some(account) = account { + error!("Error handling update for account {}: {:?}", account, err); } else { - error!("Error handling account update: {:?}", err); + error!("Error handling update: {:?}", err); } metric! { statsd_count!("ingester.ingest_update_error", 1, label.0 => &label.1, "stream" => stream, "error" => "u"); diff --git a/nft_ingester/src/transaction_notifications.rs b/nft_ingester/src/transaction_notifications.rs index 419d72744..8e5f07fb3 100644 --- a/nft_ingester/src/transaction_notifications.rs +++ b/nft_ingester/src/transaction_notifications.rs @@ -101,6 +101,7 @@ async fn handle_transaction(manager: Arc, item: RecvData) -> res, begin, tx.signature(), + None, ); } ret_id