Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[json rpc] add temp logging to get_transaction_block #19350

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions crates/sui-json-rpc/src/read_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ impl ReadApiServer for ReadApi {
digest: TransactionDigest,
opts: Option<SuiTransactionBlockResponseOptions>,
) -> RpcResult<SuiTransactionBlockResponse> {
info!("get_transaction_block started for {:?}", digest);
with_tracing!(async move {
let opts = opts.unwrap_or_default();
let mut temp_response = IntermediateTransactionResponse::new(digest);
Expand All @@ -731,6 +732,8 @@ impl ReadApiServer for ReadApi {
})
.await
.map_err(Error::from)??;
info!("get_transaction_block fetched transaction for {:?}", digest);

let input_objects = transaction
.data()
.inner()
Expand Down Expand Up @@ -761,6 +764,7 @@ impl ReadApiServer for ReadApi {
.map_err(Error::from)??,
);
}
info!("get_transaction_block fetched effects for {:?}", digest);

temp_response.checkpoint_seq = self
.transaction_kv_store
Expand All @@ -771,6 +775,11 @@ impl ReadApiServer for ReadApi {
Error::from(e)
})?;

info!(
"get_transaction_block fetched checkpoint number for {:?}",
digest
);

if let Some(checkpoint_seq) = &temp_response.checkpoint_seq {
let kv_store = self.transaction_kv_store.clone();
let checkpoint_seq = *checkpoint_seq;
Expand All @@ -787,6 +796,10 @@ impl ReadApiServer for ReadApi {
// TODO(chris): we don't need to fetch the whole checkpoint summary
temp_response.timestamp = Some(checkpoint.timestamp_ms);
}
info!(
"get_transaction_block fetched checkpoint summary for {:?}",
digest
);

if opts.show_events && temp_response.effects.is_some() {
// safe to unwrap because we have checked is_some
Expand Down Expand Up @@ -815,6 +828,7 @@ impl ReadApiServer for ReadApi {
temp_response.events = Some(SuiTransactionBlockEvents::default());
}
}
info!("get_transaction_block fetched events for {:?}", digest);

let object_cache =
ObjectProviderCache::new((self.state.clone(), self.transaction_kv_store.clone()));
Expand Down Expand Up @@ -864,6 +878,7 @@ impl ReadApiServer for ReadApi {
}
}
let epoch_store = self.state.load_epoch_store_one_call_per_task();
info!("finished request for {:?}", digest);
convert_to_response(temp_response, &opts, epoch_store.module_cache())
})
}
Expand Down
19 changes: 11 additions & 8 deletions crates/sui-storage/src/http_key_value_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use reqwest::Url;
use serde::{Deserialize, Serialize};
use std::str::FromStr;
use std::sync::Arc;
use std::time::Instant;
use sui_types::base_types::{ObjectID, SequenceNumber, VersionNumber};
use sui_types::object::Object;
use sui_types::storage::ObjectKey;
Expand All @@ -25,7 +26,7 @@ use sui_types::{
transaction::Transaction,
};
use tap::TapFallible;
use tracing::{error, info, instrument, trace, warn};
use tracing::{error, info, instrument, warn};

use crate::key_value_store::{TransactionKeyValueStore, TransactionKeyValueStoreTrait};
use crate::key_value_store_metrics::KeyValueStoreMetrics;
Expand Down Expand Up @@ -124,7 +125,7 @@ impl HttpKVStore {
pub fn new(base_url: &str) -> SuiResult<Self> {
info!("creating HttpKVStore with base_url: {}", base_url);

let client = Client::builder().http2_prior_knowledge().build().unwrap();
let client = Client::builder().build().unwrap();

let base_url = if base_url.ends_with('/') {
base_url.to_string()
Expand Down Expand Up @@ -153,21 +154,23 @@ impl HttpKVStore {
}

async fn fetch(&self, key: Key) -> SuiResult<Option<Bytes>> {
let client = Client::builder().build().unwrap();
let url = self.get_url(&key)?;
trace!("fetching url: {}", url);
let resp = self
.client
info!("fetching url: {}", url);
let start = Instant::now();
let resp = client
.get(url.clone())
.send()
.await
.into_sui_result()?;
trace!(
"got response {} for url: {}, len: {:?}",
info!(
"got response {} for url: {}, len: {:?} in {:?}",
url,
resp.status(),
resp.headers()
.get(CONTENT_LENGTH)
.unwrap_or(&HeaderValue::from_static("0"))
.unwrap_or(&HeaderValue::from_static("0")),
start.elapsed().as_millis(),
);
// return None if 400
if resp.status().is_success() {
Expand Down
Loading