From 4a93be9f77b34d9cc3f95e74f21cdc88310b4fb7 Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Thu, 16 Dec 2021 13:48:08 -0700 Subject: [PATCH] Revert "Revert "Add BigTable query logs and counter (backport #21394) (#21398)"" This reverts commit 312f2fc6f65c50476aed96f96974f6817f4d40fb. --- Cargo.lock | 1 + storage-bigtable/Cargo.toml | 1 + storage-bigtable/src/lib.rs | 31 +++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index a0059364a0..137df530a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5652,6 +5652,7 @@ dependencies = [ "serde", "serde_derive", "smpl_jwt", + "solana-metrics", "solana-sdk", "solana-storage-proto", "solana-transaction-status", diff --git a/storage-bigtable/Cargo.toml b/storage-bigtable/Cargo.toml index b263931fe9..841a35d584 100644 --- a/storage-bigtable/Cargo.toml +++ b/storage-bigtable/Cargo.toml @@ -24,6 +24,7 @@ rand_core = "0.6.2" serde = "1.0.122" serde_derive = "1.0.103" smpl_jwt = "0.6.0" +solana-metrics = { path = "../metrics", version = "=1.8.12" } solana-sdk = { path = "../sdk", version = "=1.8.12" } solana-storage-proto = { path = "../storage-proto", version = "=1.8.12" } solana-transaction-status = { path = "../transaction-status", version = "=1.8.12" } diff --git a/storage-bigtable/src/lib.rs b/storage-bigtable/src/lib.rs index 179677936f..18c6c1d8a2 100644 --- a/storage-bigtable/src/lib.rs +++ b/storage-bigtable/src/lib.rs @@ -2,6 +2,7 @@ use { log::*, serde::{Deserialize, Serialize}, + solana_metrics::inc_new_counter_debug, solana_sdk::{ clock::{Slot, UnixTimestamp}, deserialize_utils::default_on_eof, @@ -24,6 +25,9 @@ use { thiserror::Error, }; +#[macro_use] +extern crate solana_metrics; + #[macro_use] extern crate serde_derive; @@ -349,6 +353,8 @@ impl LedgerStorage { /// Return the available slot that contains a block pub async fn get_first_available_block(&self) -> Result> { + debug!("LedgerStorage::get_first_available_block request received"); + inc_new_counter_debug!("storage-bigtable-query", 1); let mut bigtable = self.connection.client(); let blocks = bigtable.get_row_keys("blocks", None, None, 1).await?; if blocks.is_empty() { @@ -363,6 +369,11 @@ impl LedgerStorage { /// limit: stop after this many slots have been found; if limit==0, all records in the table /// after start_slot will be read pub async fn get_confirmed_blocks(&self, start_slot: Slot, limit: usize) -> Result> { + debug!( + "LedgerStorage::get_confirmed_blocks request received: {:?} {:?}", + start_slot, limit + ); + inc_new_counter_debug!("storage-bigtable-query", 1); let mut bigtable = self.connection.client(); let blocks = bigtable .get_row_keys( @@ -377,6 +388,11 @@ impl LedgerStorage { /// Fetch the confirmed block from the desired slot pub async fn get_confirmed_block(&self, slot: Slot) -> Result { + debug!( + "LedgerStorage::get_confirmed_block request received: {:?}", + slot + ); + inc_new_counter_debug!("storage-bigtable-query", 1); let mut bigtable = self.connection.client(); let block_cell_data = bigtable .get_protobuf_or_bincode_cell::( @@ -397,6 +413,11 @@ impl LedgerStorage { } pub async fn get_signature_status(&self, signature: &Signature) -> Result { + debug!( + "LedgerStorage::get_signature_status request received: {:?}", + signature + ); + inc_new_counter_debug!("storage-bigtable-query", 1); let mut bigtable = self.connection.client(); let transaction_info = bigtable .get_bincode_cell::("tx", signature.to_string()) @@ -413,6 +434,11 @@ impl LedgerStorage { &self, signature: &Signature, ) -> Result> { + debug!( + "LedgerStorage::get_confirmed_transaction request received: {:?}", + signature + ); + inc_new_counter_debug!("storage-bigtable-query", 1); let mut bigtable = self.connection.client(); // Figure out which block the transaction is located in @@ -468,6 +494,11 @@ impl LedgerStorage { u32, /*slot index*/ )>, > { + debug!( + "LedgerStorage::get_confirmed_signatures_for_address request received: {:?}", + address + ); + inc_new_counter_debug!("storage-bigtable-query", 1); let mut bigtable = self.connection.client(); let address_prefix = format!("{}/", address);