a little bit more trace logging

This commit is contained in:
Bryan Stitt 2022-11-16 08:34:17 +00:00
parent a70e8873da
commit 4d8808b886
4 changed files with 20 additions and 8 deletions

View File

@ -241,6 +241,8 @@ These are roughly in order of completition
- [x] web3_proxy_cli command should read database settings from config - [x] web3_proxy_cli command should read database settings from config
- [-] add configurable size limits to all the Caches - [-] add configurable size limits to all the Caches
- instead of configuring each cache with MB sizes, have one value for total memory footprint and then percentages for each cache - instead of configuring each cache with MB sizes, have one value for total memory footprint and then percentages for each cache
- [-] more trace logging
- [ ] add more to web3_proxy_cli
- [ ] add block timestamp to the /status page - [ ] add block timestamp to the /status page
- [ ] cache the status page for a second - [ ] cache the status page for a second
- [ ] probably need to turn more sentry log integrations (like anyhow) on! - [ ] probably need to turn more sentry log integrations (like anyhow) on!

View File

@ -25,7 +25,7 @@ use futures::stream::FuturesUnordered;
use futures::stream::StreamExt; use futures::stream::StreamExt;
use hashbrown::HashMap; use hashbrown::HashMap;
use ipnet::IpNet; use ipnet::IpNet;
use log::{debug, error, info, warn}; use log::{debug, error, info, trace, warn};
use metered::{metered, ErrorCount, HitCount, ResponseTime, Throughput}; use metered::{metered, ErrorCount, HitCount, ResponseTime, Throughput};
use migration::sea_orm::{self, ConnectionTrait, Database, DatabaseConnection}; use migration::sea_orm::{self, ConnectionTrait, Database, DatabaseConnection};
use migration::sea_query::table::ColumnDef; use migration::sea_query::table::ColumnDef;
@ -640,7 +640,12 @@ impl Web3ProxyApp {
subscription_registration, subscription_registration,
); );
// // trace!(?subscription_id, "pending transactions subscription"); trace!(
"pending transactions subscription id: {:?}",
subscription_id
);
// TODO: do something with this handle?
tokio::spawn(async move { tokio::spawn(async move {
while let Some(Ok(new_tx_state)) = pending_tx_receiver.next().await { while let Some(Ok(new_tx_state)) = pending_tx_receiver.next().await {
let new_tx = match new_tx_state { let new_tx = match new_tx_state {
@ -668,7 +673,7 @@ impl Web3ProxyApp {
}; };
} }
// // trace!(?subscription_id, "closed new heads subscription"); // trace!(?subscription_id, "closed new heads subscription");
}); });
} }
Some(x) if x == json!(["newPendingFullTransactions"]) => { Some(x) if x == json!(["newPendingFullTransactions"]) => {
@ -712,7 +717,7 @@ impl Web3ProxyApp {
}; };
} }
// // trace!(?subscription_id, "closed new heads subscription"); // trace!(?subscription_id, "closed new heads subscription");
}); });
} }
Some(x) if x == json!(["newPendingRawTransactions"]) => { Some(x) if x == json!(["newPendingRawTransactions"]) => {
@ -724,7 +729,10 @@ impl Web3ProxyApp {
subscription_registration, subscription_registration,
); );
// // trace!(?subscription_id, "pending transactions subscription"); trace!(
"pending transactions subscription id: {:?}",
subscription_id
);
// TODO: do something with this handle? // TODO: do something with this handle?
tokio::spawn(async move { tokio::spawn(async move {
@ -756,7 +764,7 @@ impl Web3ProxyApp {
}; };
} }
// // trace!(?subscription_id, "closed new heads subscription"); trace!("closed new heads subscription: {:?}", subscription_id);
}); });
} }
_ => return Err(anyhow::anyhow!("unimplemented")), _ => return Err(anyhow::anyhow!("unimplemented")),

View File

@ -263,6 +263,7 @@ async fn read_web3_socket(
let subscription_count = AtomicUsize::new(1); let subscription_count = AtomicUsize::new(1);
while let Some(Ok(msg)) = ws_rx.next().await { while let Some(Ok(msg)) = ws_rx.next().await {
// TODO: spawn this?
// new message from our client. forward to a backend and then send it through response_tx // new message from our client. forward to a backend and then send it through response_tx
let response_msg = match msg { let response_msg = match msg {
Message::Text(payload) => { Message::Text(payload) => {
@ -320,6 +321,7 @@ async fn write_web3_socket(
) { ) {
// TODO: increment counter for open websockets // TODO: increment counter for open websockets
// TODO: is there any way to make this stream receive.
while let Ok(msg) = response_rx.recv_async().await { while let Ok(msg) = response_rx.recv_async().await {
// a response is ready // a response is ready

View File

@ -62,11 +62,11 @@ impl Web3Connections {
} }
if blockchain.contains_node(*block_hash) { if blockchain.contains_node(*block_hash) {
// // trace!(%block_hash, %block_num, "block already saved"); // trace!(%block_hash, %block_num, "block already saved");
return Ok(()); return Ok(());
} }
// // trace!(%block_hash, %block_num, "saving new block"); // trace!(%block_hash, %block_num, "saving new block");
// TODO: this block is very likely already in block_hashes // TODO: this block is very likely already in block_hashes
self.block_hashes self.block_hashes