diff --git a/src/handlers/history.rs b/src/handlers/history.rs index 55163bfc6..724bda248 100644 --- a/src/handlers/history.rs +++ b/src/handlers/history.rs @@ -34,6 +34,7 @@ pub async fn handler( .await } +#[tracing::instrument(skip_all)] async fn handler_internal( state: State>, connect_info: ConnectInfo, diff --git a/src/handlers/identity.rs b/src/handlers/identity.rs index 2ef3dc07e..231d36f77 100644 --- a/src/handlers/identity.rs +++ b/src/handlers/identity.rs @@ -52,6 +52,7 @@ pub async fn handler( .await } +#[tracing::instrument(skip_all)] async fn handler_internal( state: State>, connect_info: ConnectInfo, @@ -134,6 +135,7 @@ impl IdentityLookupSource { } } +#[tracing::instrument(skip_all)] async fn lookup_identity( address: H160, state: State>, @@ -199,6 +201,7 @@ async fn lookup_identity( Ok((IdentityLookupSource::Rpc, res)) } +#[tracing::instrument(skip_all)] async fn lookup_identity_rpc( address: H160, state: State>, @@ -252,6 +255,7 @@ async fn lookup_identity_rpc( const SELF_PROVIDER_ERROR_PREFIX: &str = "SelfProviderError: "; +#[tracing::instrument(skip_all)] async fn lookup_name( provider: &Provider, address: Address, @@ -275,6 +279,7 @@ async fn lookup_name( ) } +#[tracing::instrument(skip_all)] async fn lookup_avatar( provider: &Provider, name: &str, diff --git a/src/handlers/portfolio.rs b/src/handlers/portfolio.rs index dea34b11a..fcbd7be37 100644 --- a/src/handlers/portfolio.rs +++ b/src/handlers/portfolio.rs @@ -29,6 +29,7 @@ pub async fn handler( .await } +#[tracing::instrument(skip_all)] async fn handler_internal( state: State>, _connect_info: ConnectInfo, diff --git a/src/handlers/proxy.rs b/src/handlers/proxy.rs index edb1228d2..e4d86cbc8 100644 --- a/src/handlers/proxy.rs +++ b/src/handlers/proxy.rs @@ -31,6 +31,7 @@ pub async fn handler( .await } +#[tracing::instrument(skip_all)] async fn handler_internal( State(state): State>, ConnectInfo(addr): ConnectInfo, diff --git a/src/handlers/ws_proxy.rs b/src/handlers/ws_proxy.rs index c60fb74c0..17e77360c 100644 --- a/src/handlers/ws_proxy.rs +++ b/src/handlers/ws_proxy.rs @@ -20,6 +20,7 @@ pub async fn handler( .await } +#[tracing::instrument(skip_all)] async fn handler_internal( State(state): State>, Query(query_params): Query, diff --git a/src/providers/base.rs b/src/providers/base.rs index cfd40cdef..8ea0775d0 100644 --- a/src/providers/base.rs +++ b/src/providers/base.rs @@ -47,6 +47,7 @@ impl RateLimited for BaseProvider { #[async_trait] impl RpcProvider for BaseProvider { + #[tracing::instrument(skip(self, body), fields(provider = %self.provider_kind()))] async fn proxy(&self, chain_id: &str, body: hyper::body::Bytes) -> RpcResult { let uri = self .supported_chains @@ -81,6 +82,7 @@ impl RpcProvider for BaseProvider { } impl RpcProviderFactory for BaseProvider { + #[tracing::instrument] fn new(provider_config: &BaseConfig) -> Self { let forward_proxy_client = Client::builder().build::<_, hyper::Body>(HttpsConnector::new()); let supported_chains: HashMap = provider_config diff --git a/src/providers/binance.rs b/src/providers/binance.rs index b7fe1f465..5e250136d 100644 --- a/src/providers/binance.rs +++ b/src/providers/binance.rs @@ -47,6 +47,7 @@ impl RateLimited for BinanceProvider { #[async_trait] impl RpcProvider for BinanceProvider { + #[tracing::instrument(skip(self, body), fields(provider = %self.provider_kind()))] async fn proxy(&self, chain_id: &str, body: hyper::body::Bytes) -> RpcResult { let uri = self .supported_chains @@ -81,6 +82,7 @@ impl RpcProvider for BinanceProvider { } impl RpcProviderFactory for BinanceProvider { + #[tracing::instrument] fn new(provider_config: &BinanceConfig) -> Self { let forward_proxy_client = Client::builder().build::<_, hyper::Body>(HttpsConnector::new()); let supported_chains: HashMap = provider_config diff --git a/src/providers/infura.rs b/src/providers/infura.rs index 921660649..8bff10053 100644 --- a/src/providers/infura.rs +++ b/src/providers/infura.rs @@ -66,6 +66,7 @@ impl RateLimited for InfuraWsProvider { #[async_trait] impl RpcWsProvider for InfuraWsProvider { + #[tracing::instrument(skip_all, fields(provider = %self.provider_kind()))] async fn proxy( &self, ws: WebSocketUpgrade, @@ -115,6 +116,7 @@ impl RateLimited for InfuraProvider { #[async_trait] impl RpcProvider for InfuraProvider { + #[tracing::instrument(skip(self, body), fields(provider = %self.provider_kind()))] async fn proxy(&self, chain_id: &str, body: hyper::body::Bytes) -> RpcResult { let chain = &self .supported_chains @@ -156,6 +158,7 @@ impl RpcProvider for InfuraProvider { } impl RpcProviderFactory for InfuraProvider { + #[tracing::instrument] fn new(provider_config: &InfuraConfig) -> Self { let forward_proxy_client = Client::builder().build::<_, hyper::Body>(HttpsConnector::new()); let supported_chains: HashMap = provider_config @@ -173,6 +176,7 @@ impl RpcProviderFactory for InfuraProvider { } impl RpcProviderFactory for InfuraWsProvider { + #[tracing::instrument] fn new(provider_config: &InfuraConfig) -> Self { let supported_chains: HashMap = provider_config .supported_ws_chains diff --git a/src/providers/mod.rs b/src/providers/mod.rs index 49536b5b2..8bde08cb2 100644 --- a/src/providers/mod.rs +++ b/src/providers/mod.rs @@ -114,6 +114,7 @@ impl ProviderRepository { } } + #[tracing::instrument(skip(self))] pub fn get_provider_for_chain_id(&self, chain_id: &str) -> Option> { let Some(providers) = self.weight_resolver.get(chain_id) else { return None; @@ -139,6 +140,7 @@ impl ProviderRepository { } } + #[tracing::instrument(skip(self))] pub fn get_ws_provider_for_chain_id(&self, chain_id: &str) -> Option> { let Some(providers) = self.ws_weight_resolver.get(chain_id) else { return None; @@ -214,6 +216,7 @@ impl ProviderRepository { info!("Added provider: {}", provider_kind); } + #[tracing::instrument(skip_all)] pub async fn update_weights(&self, metrics: &crate::Metrics) { info!("Updating weights"); diff --git a/src/providers/omnia.rs b/src/providers/omnia.rs index 79ff5116a..190fb4fd6 100644 --- a/src/providers/omnia.rs +++ b/src/providers/omnia.rs @@ -47,6 +47,7 @@ impl RateLimited for OmniatechProvider { #[async_trait] impl RpcProvider for OmniatechProvider { + #[tracing::instrument(skip(self, body), fields(provider = %self.provider_kind()))] async fn proxy(&self, chain_id: &str, body: hyper::body::Bytes) -> RpcResult { let chain = self .supported_chains @@ -83,6 +84,7 @@ impl RpcProvider for OmniatechProvider { } impl RpcProviderFactory for OmniatechProvider { + #[tracing::instrument] fn new(provider_config: &OmniatechConfig) -> Self { let forward_proxy_client = Client::builder().build::<_, hyper::Body>(HttpsConnector::new()); let supported_chains: HashMap = provider_config diff --git a/src/providers/pokt.rs b/src/providers/pokt.rs index 966b97abf..c99ba96a8 100644 --- a/src/providers/pokt.rs +++ b/src/providers/pokt.rs @@ -69,6 +69,7 @@ impl RateLimited for PoktProvider { #[async_trait] impl RpcProvider for PoktProvider { + #[tracing::instrument(skip(self, body), fields(provider = %self.provider_kind()))] async fn proxy(&self, chain_id: &str, body: hyper::body::Bytes) -> RpcResult { let chain = &self .supported_chains @@ -116,6 +117,7 @@ impl RpcProvider for PoktProvider { } impl RpcProviderFactory for PoktProvider { + #[tracing::instrument] fn new(provider_config: &PoktConfig) -> Self { let forward_proxy_client = Client::builder().build::<_, hyper::Body>(HttpsConnector::new()); let supported_chains: HashMap = provider_config diff --git a/src/providers/publicnode.rs b/src/providers/publicnode.rs index 42bbae50a..44c7963dc 100644 --- a/src/providers/publicnode.rs +++ b/src/providers/publicnode.rs @@ -44,6 +44,7 @@ impl RateLimited for PublicnodeProvider { #[async_trait] impl RpcProvider for PublicnodeProvider { + #[tracing::instrument(skip(self, body), fields(provider = %self.provider_kind()))] async fn proxy(&self, chain_id: &str, body: hyper::body::Bytes) -> RpcResult { let chain = &self .supported_chains @@ -80,6 +81,7 @@ impl RpcProvider for PublicnodeProvider { } impl RpcProviderFactory for PublicnodeProvider { + #[tracing::instrument] fn new(provider_config: &PublicnodeConfig) -> Self { let forward_proxy_client = Client::builder().build::<_, hyper::Body>(HttpsConnector::new()); let supported_chains: HashMap = provider_config diff --git a/src/providers/weights.rs b/src/providers/weights.rs index 37eb213b1..3379b10ee 100644 --- a/src/providers/weights.rs +++ b/src/providers/weights.rs @@ -14,6 +14,7 @@ pub struct Availability(u64, u64); pub type ParsedWeights = HashMap, Availability)>; +#[tracing::instrument(skip_all)] pub fn parse_weights(prometheus_data: PromqlResult) -> ParsedWeights { let mut weights_data = HashMap::new(); // fill weights with pair of ProviderKind -> HashMap @@ -60,6 +61,7 @@ pub fn parse_weights(prometheus_data: PromqlResult) -> ParsedWeights { const PERFECT_RATIO: f64 = 1.0; +#[tracing::instrument] fn calculate_chain_weight( provider_availability: Availability, chain_availability: Availability, @@ -111,6 +113,7 @@ fn calculate_chain_weight( weight as u64 } +#[tracing::instrument(skip_all)] pub fn update_values(weight_resolver: &WeightResolver, parsed_weights: ParsedWeights) { for (provider, (chain_availabilities, provider_availability)) in parsed_weights { for (chain_id, chain_availability) in chain_availabilities { diff --git a/src/providers/zerion.rs b/src/providers/zerion.rs index b5a814586..c8a9527fb 100644 --- a/src/providers/zerion.rs +++ b/src/providers/zerion.rs @@ -148,6 +148,7 @@ pub struct ZerionTransactionNFTInfoFlags { #[async_trait] impl HistoryProvider for ZerionProvider { + #[tracing::instrument(skip(self, body, params), fields(provider = "Zerion"))] async fn get_transactions( &self, address: String, @@ -237,6 +238,7 @@ impl HistoryProvider for ZerionProvider { #[async_trait] impl PortfolioProvider for ZerionProvider { + #[tracing::instrument(skip(self, body, params), fields(provider = "Zerion"))] async fn get_portfolio( &self, address: String, diff --git a/src/providers/zksync.rs b/src/providers/zksync.rs index 52a68b83b..bbd0a28bd 100644 --- a/src/providers/zksync.rs +++ b/src/providers/zksync.rs @@ -44,6 +44,7 @@ impl RateLimited for ZKSyncProvider { #[async_trait] impl RpcProvider for ZKSyncProvider { + #[tracing::instrument(skip(self, body), fields(provider = %self.provider_kind()))] async fn proxy(&self, chain_id: &str, body: hyper::body::Bytes) -> RpcResult { let uri = self .supported_chains @@ -78,6 +79,7 @@ impl RpcProvider for ZKSyncProvider { } impl RpcProviderFactory for ZKSyncProvider { + #[tracing::instrument] fn new(provider_config: &ZKSyncConfig) -> Self { let forward_proxy_client = Client::builder().build::<_, hyper::Body>(HttpsConnector::new()); let supported_chains: HashMap = provider_config diff --git a/src/providers/zora.rs b/src/providers/zora.rs index 1b8e3182b..f505bf3a5 100644 --- a/src/providers/zora.rs +++ b/src/providers/zora.rs @@ -64,6 +64,7 @@ impl RateLimited for ZoraWsProvider { #[async_trait] impl RpcWsProvider for ZoraWsProvider { + #[tracing::instrument(skip_all, fields(provider = %self.provider_kind()))] async fn proxy( &self, ws: WebSocketUpgrade, @@ -111,6 +112,7 @@ impl RateLimited for ZoraProvider { #[async_trait] impl RpcProvider for ZoraProvider { + #[tracing::instrument(skip(self, body), fields(provider = %self.provider_kind()))] async fn proxy(&self, chain_id: &str, body: hyper::body::Bytes) -> RpcResult { let uri = self .supported_chains @@ -145,6 +147,7 @@ impl RpcProvider for ZoraProvider { } impl RpcProviderFactory for ZoraProvider { + #[tracing::instrument] fn new(provider_config: &ZoraConfig) -> Self { let forward_proxy_client = Client::builder().build::<_, hyper::Body>(HttpsConnector::new()); let supported_chains: HashMap = provider_config @@ -161,6 +164,7 @@ impl RpcProviderFactory for ZoraProvider { } impl RpcProviderFactory for ZoraWsProvider { + #[tracing::instrument] fn new(provider_config: &ZoraConfig) -> Self { let supported_chains: HashMap = provider_config .supported_ws_chains diff --git a/src/state.rs b/src/state.rs index 702eb04ed..2751a0264 100644 --- a/src/state.rs +++ b/src/state.rs @@ -57,6 +57,7 @@ impl AppState { self.providers.update_weights(&self.metrics).await; } + #[tracing::instrument(skip(self))] async fn get_project_data_validated(&self, id: &str) -> Result { let project = self .registry @@ -76,6 +77,7 @@ impl AppState { self.get_project_data_validated(id).await.map(drop) } + #[tracing::instrument(skip(self))] pub async fn validate_project_access_and_quota(&self, id: &str) -> Result<(), RpcError> { let project = self.get_project_data_validated(id).await?; diff --git a/src/ws.rs b/src/ws.rs index 09e686369..ab8754cb8 100644 --- a/src/ws.rs +++ b/src/ws.rs @@ -4,6 +4,7 @@ use { tracing::log::info, }; +#[tracing::instrument(skip(client_ws, provider_ws))] pub async fn proxy( project_id: String, client_ws: axum_tungstenite::WebSocket,