diff --git a/web3_proxy/src/app.rs b/web3_proxy/src/app.rs index 00553d9a..0cc3abf6 100644 --- a/web3_proxy/src/app.rs +++ b/web3_proxy/src/app.rs @@ -43,7 +43,7 @@ use tokio::sync::{broadcast, watch, Semaphore}; use tokio::task::JoinHandle; use tokio::time::timeout; use tokio_stream::wrappers::{BroadcastStream, WatchStream}; -use tracing::{error, info, trace, warn}; +use tracing::{error, info, instrument, trace, warn}; use ulid::Ulid; // TODO: make this customizable? @@ -118,6 +118,7 @@ pub struct Web3ProxyApp { /// flatten a JoinError into an anyhow error /// Useful when joining multiple futures. +#[instrument(skip_all)] pub async fn flatten_handle(handle: AnyhowJoinHandle) -> anyhow::Result { match handle.await { Ok(Ok(result)) => Ok(result), @@ -127,6 +128,7 @@ pub async fn flatten_handle(handle: AnyhowJoinHandle) -> anyhow::Result } /// return the first error or okay if everything worked +#[instrument(skip_all)] pub async fn flatten_handles( mut handles: FuturesUnordered>, ) -> anyhow::Result<()> { @@ -142,6 +144,7 @@ pub async fn flatten_handles( } /// Connect to the database and run migrations +#[instrument(level = "trace")] pub async fn get_migrated_db( db_url: String, min_connections: u32, @@ -172,6 +175,7 @@ pub async fn get_migrated_db( #[metered(registry = Web3ProxyAppMetrics, registry_expr = self.app_metrics, visibility = pub)] impl Web3ProxyApp { /// The main entrypoint. + #[instrument(level = "trace")] pub async fn spawn( top_config: TopConfig, num_workers: usize, @@ -492,6 +496,7 @@ impl Web3ProxyApp { Ok((app, cancellable_handles, important_background_handles)) } + #[instrument(level = "trace")] pub fn prometheus_metrics(&self) -> String { let globals = HashMap::new(); // TODO: what globals? should this be the hostname or what? @@ -513,6 +518,7 @@ impl Web3ProxyApp { } #[measure([ErrorCount, HitCount, ResponseTime, Throughput])] + #[instrument(level = "trace")] pub async fn eth_subscribe<'a>( self: &'a Arc, authorized_request: Arc, @@ -709,6 +715,7 @@ impl Web3ProxyApp { } /// send the request or batch of requests to the approriate RPCs + #[instrument(level = "trace")] pub async fn proxy_web3_rpc( self: &Arc, authorized_request: Arc, @@ -747,6 +754,7 @@ impl Web3ProxyApp { /// cut up the request and send to potentually different servers /// TODO: make sure this isn't a problem + #[instrument(level = "trace")] async fn proxy_web3_rpc_requests( self: &Arc, authorized_request: Arc, @@ -779,10 +787,12 @@ impl Web3ProxyApp { } /// TODO: i don't think we want or need this. just use app.db_conn, or maybe app.db_conn.clone() or app.db_conn.as_ref() + #[instrument(level = "trace")] pub fn db_conn(&self) -> Option { self.db_conn.clone() } + #[instrument(level = "trace")] pub async fn redis_conn(&self) -> anyhow::Result { match self.vredis_pool.as_ref() { None => Err(anyhow::anyhow!("no redis server configured")), @@ -795,6 +805,7 @@ impl Web3ProxyApp { } #[measure([ErrorCount, HitCount, ResponseTime, Throughput])] + #[instrument(level = "trace")] async fn proxy_web3_rpc_request( self: &Arc, authorized_request: Arc, diff --git a/web3_proxy/src/block_number.rs b/web3_proxy/src/block_number.rs index 6bef5de6..6d361040 100644 --- a/web3_proxy/src/block_number.rs +++ b/web3_proxy/src/block_number.rs @@ -4,7 +4,7 @@ use ethers::{ prelude::{BlockNumber, U64}, types::H256, }; -use tracing::warn; +use tracing::{instrument, warn}; use crate::rpcs::connections::Web3Connections; @@ -38,6 +38,7 @@ pub fn block_num_to_u64(block_num: BlockNumber, latest_block: U64) -> U64 { } /// modify params to always have a block number and not "latest" +#[instrument(level = "trace")] pub async fn clean_block_number( params: &mut serde_json::Value, block_param_id: usize, @@ -95,6 +96,7 @@ pub async fn clean_block_number( } // TODO: change this to also return the hash needed? +#[instrument(level = "trace")] pub async fn block_needed( method: &str, params: Option<&mut serde_json::Value>, diff --git a/web3_proxy/src/config.rs b/web3_proxy/src/config.rs index a2f3b163..66a9fc8d 100644 --- a/web3_proxy/src/config.rs +++ b/web3_proxy/src/config.rs @@ -9,6 +9,7 @@ use hashbrown::HashMap; use serde::Deserialize; use std::sync::Arc; use tokio::sync::broadcast; +use tracing::instrument; pub type BlockAndRpc = (Option, Arc); pub type TxHashAndRpc = (TxHash, Arc); @@ -194,6 +195,7 @@ impl Web3ConnectionConfig { /// Create a Web3Connection from config /// TODO: move this into Web3Connection (just need to make things pub(crate)) #[allow(clippy::too_many_arguments)] + #[instrument(level = "trace", skip(redis_pool))] pub async fn spawn( self, name: String, diff --git a/web3_proxy/src/frontend/authorization.rs b/web3_proxy/src/frontend/authorization.rs index be4dce99..088a85b8 100644 --- a/web3_proxy/src/frontend/authorization.rs +++ b/web3_proxy/src/frontend/authorization.rs @@ -20,7 +20,7 @@ use std::sync::atomic::{AtomicBool, AtomicU64}; use std::{net::IpAddr, str::FromStr, sync::Arc}; use tokio::sync::{OwnedSemaphorePermit, Semaphore}; use tokio::time::Instant; -use tracing::{error, trace}; +use tracing::{error, instrument, trace}; use ulid::Ulid; use uuid::Uuid; @@ -322,6 +322,7 @@ pub async fn key_is_authorized( impl Web3ProxyApp { /// Limit the number of concurrent requests from the given ip address. + #[instrument(level = "trace")] pub async fn ip_semaphore(&self, ip: IpAddr) -> anyhow::Result> { if let Some(max_concurrent_requests) = self.config.public_max_concurrent_requests { let semaphore = self @@ -347,6 +348,7 @@ impl Web3ProxyApp { } /// Limit the number of concurrent requests from the given key address. + #[instrument(level = "trace")] pub async fn user_rpc_key_semaphore( &self, rpc_key_data: &UserKeyData, @@ -375,6 +377,7 @@ impl Web3ProxyApp { /// Verify that the given bearer token and address are allowed to take the specified action. /// This includes concurrent request limiting. + #[instrument(level = "trace")] pub async fn bearer_is_authorized( &self, bearer: Bearer, @@ -414,6 +417,7 @@ impl Web3ProxyApp { Ok((user, semaphore_permit)) } + #[instrument(level = "trace")] pub async fn rate_limit_login(&self, ip: IpAddr) -> anyhow::Result { // TODO: dry this up with rate_limit_by_key // TODO: do we want a semaphore here? @@ -446,6 +450,7 @@ impl Web3ProxyApp { } } + #[instrument(level = "trace")] pub async fn rate_limit_by_ip( &self, ip: IpAddr, @@ -495,6 +500,7 @@ impl Web3ProxyApp { } // check the local cache for user data, or query the database + #[instrument(level = "trace")] pub(crate) async fn user_data(&self, rpc_key: RpcApiKey) -> anyhow::Result { let user_data: Result<_, Arc> = self .rpc_key_cache @@ -589,6 +595,7 @@ impl Web3ProxyApp { user_data.map_err(|err| anyhow::anyhow!(err)) } + #[instrument(level = "trace")] pub async fn rate_limit_by_key(&self, rpc_key: RpcApiKey) -> anyhow::Result { let user_data = self.user_data(rpc_key).await?; diff --git a/web3_proxy/src/frontend/errors.rs b/web3_proxy/src/frontend/errors.rs index bff45bec..42f24062 100644 --- a/web3_proxy/src/frontend/errors.rs +++ b/web3_proxy/src/frontend/errors.rs @@ -15,13 +15,13 @@ use reqwest::header::ToStrError; use sea_orm::DbErr; use std::{error::Error, net::IpAddr}; use tokio::time::Instant; -use tracing::warn; +use tracing::{instrument, warn}; // TODO: take "IntoResponse" instead of Response? pub type FrontendResult = Result; // TODO: -#[derive(From)] +#[derive(Debug, From)] pub enum FrontendErrorResponse { Anyhow(anyhow::Error), Box(Box), @@ -41,6 +41,7 @@ pub enum FrontendErrorResponse { } impl IntoResponse for FrontendErrorResponse { + #[instrument(level = "trace")] fn into_response(self) -> Response { // TODO: include the request id in these so that users can give us something that will point to logs let (status_code, response) = match self { @@ -202,6 +203,7 @@ impl IntoResponse for FrontendErrorResponse { } } +#[instrument(level = "trace")] pub async fn handler_404() -> Response { FrontendErrorResponse::NotFound.into_response() } diff --git a/web3_proxy/src/frontend/mod.rs b/web3_proxy/src/frontend/mod.rs index 908897b3..a9008941 100644 --- a/web3_proxy/src/frontend/mod.rs +++ b/web3_proxy/src/frontend/mod.rs @@ -24,9 +24,10 @@ use tower_http::cors::CorsLayer; use tower_http::sensitive_headers::SetSensitiveRequestHeadersLayer; use tower_http::trace::TraceLayer; use tower_request_id::{RequestId, RequestIdLayer}; -use tracing::{error_span, info}; +use tracing::{error_span, info, instrument}; /// Start the frontend server. +#[instrument(level = "trace")] pub async fn serve(port: u16, proxy_app: Arc) -> anyhow::Result<()> { // create a tracing span for each request with a random request id and the method // GET: websocket or static pages diff --git a/web3_proxy/src/frontend/rpc_proxy_http.rs b/web3_proxy/src/frontend/rpc_proxy_http.rs index f4834d3f..ae8d9464 100644 --- a/web3_proxy/src/frontend/rpc_proxy_http.rs +++ b/web3_proxy/src/frontend/rpc_proxy_http.rs @@ -10,12 +10,13 @@ use axum::{response::IntoResponse, Extension, Json}; use axum_client_ip::ClientIp; use axum_macros::debug_handler; use std::sync::Arc; -use tracing::{error_span, Instrument}; +use tracing::{error_span, instrument, Instrument}; /// POST /rpc -- Public entrypoint for HTTP JSON-RPC requests. Web3 wallets use this. /// Defaults to rate limiting by IP address, but can also read the Authorization header for a bearer token. /// If possible, please use a WebSocket instead. #[debug_handler] +#[instrument(level = "trace")] pub async fn proxy_web3_rpc( Extension(app): Extension>, ClientIp(ip): ClientIp, @@ -49,6 +50,7 @@ pub async fn proxy_web3_rpc( /// Can optionally authorized based on origin, referer, or user agent. /// If possible, please use a WebSocket instead. #[debug_handler] +#[instrument(level = "trace")] pub async fn proxy_web3_rpc_with_key( Extension(app): Extension>, ClientIp(ip): ClientIp, diff --git a/web3_proxy/src/frontend/rpc_proxy_ws.rs b/web3_proxy/src/frontend/rpc_proxy_ws.rs index 915bc6db..7574b67f 100644 --- a/web3_proxy/src/frontend/rpc_proxy_ws.rs +++ b/web3_proxy/src/frontend/rpc_proxy_ws.rs @@ -23,7 +23,7 @@ use hashbrown::HashMap; use serde_json::{json, value::RawValue}; use std::sync::Arc; use std::{str::from_utf8_mut, sync::atomic::AtomicUsize}; -use tracing::{error, error_span, info, trace, Instrument}; +use tracing::{error, error_span, info, instrument, trace, Instrument}; use crate::{ app::Web3ProxyApp, @@ -33,6 +33,7 @@ use crate::{ /// Public entrypoint for WebSocket JSON-RPC requests. /// Defaults to rate limiting by IP address, but can also read the Authorization header for a bearer token. #[debug_handler] +#[instrument(level = "trace")] pub async fn websocket_handler( Extension(app): Extension>, ClientIp(ip): ClientIp, @@ -75,6 +76,7 @@ pub async fn websocket_handler( /// Rate limit and billing based on the api key in the url. /// Can optionally authorized based on origin, referer, or user agent. #[debug_handler] +#[instrument(level = "trace")] pub async fn websocket_handler_with_key( Extension(app): Extension>, ClientIp(ip): ClientIp, @@ -134,6 +136,7 @@ pub async fn websocket_handler_with_key( } } +#[instrument(level = "trace")] async fn proxy_web3_socket( app: Arc, authorized_request: Arc, @@ -155,6 +158,7 @@ async fn proxy_web3_socket( } /// websockets support a few more methods than http clients +#[instrument(level = "trace")] async fn handle_socket_payload( app: Arc, authorized_request: Arc, @@ -245,6 +249,7 @@ async fn handle_socket_payload( Message::Text(response_str) } +#[instrument(level = "trace")] async fn read_web3_socket( app: Arc, authorized_request: Arc, @@ -303,6 +308,7 @@ async fn read_web3_socket( } } +#[instrument(level = "trace")] async fn write_web3_socket( response_rx: flume::Receiver, mut ws_tx: SplitSink, diff --git a/web3_proxy/src/frontend/status.rs b/web3_proxy/src/frontend/status.rs index 0ba548d9..1d9d28f4 100644 --- a/web3_proxy/src/frontend/status.rs +++ b/web3_proxy/src/frontend/status.rs @@ -9,9 +9,11 @@ use axum_macros::debug_handler; use moka::future::ConcurrentCacheExt; use serde_json::json; use std::sync::Arc; +use tracing::instrument; /// Health check page for load balancers to use. #[debug_handler] +#[instrument(level = "trace")] pub async fn health(Extension(app): Extension>) -> impl IntoResponse { // TODO: also check that the head block is not too old if app.balanced_rpcs.synced() { @@ -25,6 +27,7 @@ pub async fn health(Extension(app): Extension>) -> impl IntoRe /// /// TODO: when done debugging, remove this and only allow access on a different port #[debug_handler] +#[instrument(level = "trace")] pub async fn prometheus(Extension(app): Extension>) -> impl IntoResponse { app.prometheus_metrics() } @@ -33,6 +36,7 @@ pub async fn prometheus(Extension(app): Extension>) -> impl In /// /// TODO: replace this with proper stats and monitoring #[debug_handler] +#[instrument(level = "trace")] pub async fn status(Extension(app): Extension>) -> impl IntoResponse { app.pending_transactions.sync(); app.rpc_key_cache.sync(); diff --git a/web3_proxy/src/frontend/users.rs b/web3_proxy/src/frontend/users.rs index f58a9cd3..3bbe9454 100644 --- a/web3_proxy/src/frontend/users.rs +++ b/web3_proxy/src/frontend/users.rs @@ -35,7 +35,7 @@ use std::ops::Add; use std::str::FromStr; use std::sync::Arc; use time::{Duration, OffsetDateTime}; -use tracing::warn; +use tracing::{instrument, warn}; use ulid::Ulid; use uuid::Uuid; @@ -57,6 +57,7 @@ use uuid::Uuid; /// It is a better UX to just click "login with ethereum" and have the account created if it doesn't exist. /// We can prompt for an email and and payment after they log in. #[debug_handler] +#[instrument(level = "trace")] pub async fn user_login_get( Extension(app): Extension>, ClientIp(ip): ClientIp, @@ -143,7 +144,7 @@ pub struct PostLoginQuery { /// JSON body to our `post_login` handler. /// Currently only siwe logins that send an address, msg, and sig are allowed. /// Email/password and other login methods are planned. -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] pub struct PostLogin { sig: String, msg: String, @@ -153,6 +154,7 @@ pub struct PostLogin { /// It is recommended to save the returned bearer token in a cookie. /// The bearer token can be used to authenticate other requests, such as getting the user's stats or modifying the user's profile. #[debug_handler] +#[instrument(level = "trace")] pub async fn user_login_post( Extension(app): Extension>, ClientIp(ip): ClientIp, @@ -330,6 +332,7 @@ pub async fn user_login_post( /// `POST /user/logout` - Forget the bearer token in the `Authentication` header. #[debug_handler] +#[instrument(level = "trace")] pub async fn user_logout_post( Extension(app): Extension>, TypedHeader(Authorization(bearer)): TypedHeader>, @@ -351,6 +354,7 @@ pub async fn user_logout_post( /// /// TODO: this will change as we add better support for secondary users. #[debug_handler] +#[instrument(level = "trace")] pub async fn user_get( Extension(app): Extension>, TypedHeader(Authorization(bearer_token)): TypedHeader>, @@ -361,13 +365,14 @@ pub async fn user_get( } /// the JSON input to the `post_user` handler. -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] pub struct UserPost { email: Option, } /// `POST /user` -- modify the account connected to the bearer token in the `Authentication` header. #[debug_handler] +#[instrument(level = "trace")] pub async fn user_post( Extension(app): Extension>, TypedHeader(Authorization(bearer_token)): TypedHeader>, @@ -414,6 +419,7 @@ pub async fn user_post( /// TODO: one key per request? maybe /user/balance/:rpc_key? /// TODO: this will change as we add better support for secondary users. #[debug_handler] +#[instrument(level = "trace")] pub async fn user_balance_get( Extension(app): Extension>, TypedHeader(Authorization(bearer)): TypedHeader>, @@ -431,6 +437,7 @@ pub async fn user_balance_get( /// TODO: one key per request? maybe /user/balance/:rpc_key? /// TODO: this will change as we add better support for secondary users. #[debug_handler] +#[instrument(level = "trace")] pub async fn user_balance_post( Extension(app): Extension>, TypedHeader(Authorization(bearer)): TypedHeader>, @@ -444,6 +451,7 @@ pub async fn user_balance_post( /// /// TODO: one key per request? maybe /user/keys/:rpc_key? #[debug_handler] +#[instrument(level = "trace")] pub async fn rpc_keys_get( Extension(app): Extension>, TypedHeader(Authorization(bearer)): TypedHeader>, @@ -471,7 +479,7 @@ pub async fn rpc_keys_get( } /// the JSON input to the `rpc_keys_post` handler. -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] pub struct UserKeysPost { // TODO: make sure the email address is valid. probably have a "verified" column in the database existing_key_id: Option, @@ -493,6 +501,7 @@ pub struct UserKeysPost { /// TODO: read json from the request body /// TODO: one key per request? maybe /user/keys/:rpc_key? #[debug_handler] +#[instrument(level = "trace")] pub async fn rpc_keys_post( Extension(app): Extension>, TypedHeader(Authorization(bearer)): TypedHeader>, @@ -668,6 +677,7 @@ pub async fn rpc_keys_post( /// `GET /user/revert_logs` -- Use a bearer token to get the user's revert logs. #[debug_handler] +#[instrument(level = "trace")] pub async fn user_revert_logs_get( Extension(app): Extension>, TypedHeader(Authorization(bearer)): TypedHeader>, @@ -731,6 +741,7 @@ pub async fn user_revert_logs_get( /// /// TODO: this will change as we add better support for secondary users. #[debug_handler] +#[instrument(level = "trace")] pub async fn user_stats_detailed_get( Extension(app): Extension>, bearer: Option>>, @@ -743,6 +754,7 @@ pub async fn user_stats_detailed_get( /// `GET /user/stats/aggregate` -- Public endpoint for aggregate stats such as bandwidth used and methods requested. #[debug_handler] +#[instrument(level = "trace")] pub async fn user_stats_aggregate_get( bearer: Option>>, Extension(app): Extension>, diff --git a/web3_proxy/src/jsonrpc.rs b/web3_proxy/src/jsonrpc.rs index 5cd2706a..8a9feed4 100644 --- a/web3_proxy/src/jsonrpc.rs +++ b/web3_proxy/src/jsonrpc.rs @@ -4,6 +4,7 @@ use serde::de::{self, Deserializer, MapAccess, SeqAccess, Visitor}; use serde::{Deserialize, Serialize}; use serde_json::value::RawValue; use std::fmt; +use tracing::instrument; // this is used by serde #[allow(dead_code)] @@ -193,10 +194,12 @@ impl JsonRpcForwardedResponse { Self::from_string(message, code, id) } + #[instrument(level = "trace")] pub fn from_str(message: &str, code: Option, id: Option>) -> Self { Self::from_string(message.to_string(), code, id) } + #[instrument(level = "trace")] pub fn from_string(message: String, code: Option, id: Option>) -> Self { // TODO: this is too verbose. plenty of errors are valid, like users giving an invalid address. no need to log that // TODO: can we somehow get the initial request here? if we put that into a tracing span, will things slow down a ton? @@ -214,6 +217,7 @@ impl JsonRpcForwardedResponse { } } + #[instrument(level = "trace")] pub fn from_response(partial_response: Box, id: Box) -> Self { JsonRpcForwardedResponse { jsonrpc: "2.0".to_string(), @@ -224,6 +228,7 @@ impl JsonRpcForwardedResponse { } } + #[instrument(level = "trace")] pub fn from_value(partial_response: serde_json::Value, id: Box) -> Self { let partial_response = serde_json::to_string(&partial_response).expect("this should always work"); @@ -239,6 +244,7 @@ impl JsonRpcForwardedResponse { } } + #[instrument(level = "trace")] pub fn from_ethers_error(e: ProviderError, id: Box) -> anyhow::Result { // TODO: move turning ClientError into json to a helper function? let code; @@ -298,6 +304,7 @@ impl JsonRpcForwardedResponse { }) } + #[instrument(level = "trace")] pub fn try_from_response_result( result: Result, ProviderError>, id: Box, diff --git a/web3_proxy/src/metrics_frontend.rs b/web3_proxy/src/metrics_frontend.rs index 2284017d..823d8442 100644 --- a/web3_proxy/src/metrics_frontend.rs +++ b/web3_proxy/src/metrics_frontend.rs @@ -4,11 +4,12 @@ use axum::response::{IntoResponse, Response}; use axum::{routing::get, Extension, Router}; use std::net::SocketAddr; use std::sync::Arc; -use tracing::info; +use tracing::{info, instrument}; use crate::app::Web3ProxyApp; /// Run a prometheus metrics server on the given port. +#[instrument(level = "trace")] pub async fn serve(app: Arc, port: u16) -> anyhow::Result<()> { // build our application with a route // order most to least common @@ -41,6 +42,7 @@ pub async fn serve(app: Arc, port: u16) -> anyhow::Result<()> { .map_err(Into::into) } +#[instrument(level = "trace")] async fn root(Extension(app): Extension>) -> Response { let serialized = app.prometheus_metrics(); diff --git a/web3_proxy/src/rpcs/blockchain.rs b/web3_proxy/src/rpcs/blockchain.rs index 09ab7bd5..7aeb2481 100644 --- a/web3_proxy/src/rpcs/blockchain.rs +++ b/web3_proxy/src/rpcs/blockchain.rs @@ -16,7 +16,7 @@ use serde_json::json; use std::{cmp::Ordering, fmt::Display, sync::Arc}; use tokio::sync::{broadcast, watch}; use tokio::time::Duration; -use tracing::{debug, info, trace, warn, Level}; +use tracing::{debug, instrument, trace, warn, Level}; // TODO: type for Hydrated Blocks with their full transactions? pub type ArcBlock = Arc>; @@ -38,6 +38,7 @@ impl Display for BlockId { impl Web3Connections { /// add a block to our map and it's hash to our graphmap of the blockchain + #[instrument] pub async fn save_block(&self, block: &ArcBlock, heaviest_chain: bool) -> anyhow::Result<()> { // TODO: i think we can rearrange this function to make it faster on the hot path let block_hash = block.hash.as_ref().context("no block hash")?; @@ -84,6 +85,7 @@ impl Web3Connections { /// Get a block from caches with fallback. /// Will query a specific node or the best available. + #[instrument(level = "trace")] pub async fn block( &self, authorized_request: Option<&Arc>, diff --git a/web3_proxy/src/user_queries.rs b/web3_proxy/src/user_queries.rs index 27495068..68729cb0 100644 --- a/web3_proxy/src/user_queries.rs +++ b/web3_proxy/src/user_queries.rs @@ -13,12 +13,13 @@ use sea_orm::{ ColumnTrait, Condition, EntityTrait, JoinType, PaginatorTrait, QueryFilter, QueryOrder, QuerySelect, RelationTrait, }; -use tracing::trace; +use tracing::{instrument, trace}; use crate::app::Web3ProxyApp; /// get the attached address from redis for the given auth_token. /// 0 means all users +#[instrument(level = "trace", skip(redis_conn))] async fn get_user_id_from_params( mut redis_conn: RedisConnection, // this is a long type. should we strip it down? @@ -56,6 +57,7 @@ async fn get_user_id_from_params( /// only allow rpc_key to be set if user_id is also set. /// this will keep people from reading someone else's keys. /// 0 means none. +#[instrument(level = "trace")] pub fn get_rpc_key_id_from_params( user_id: u64, params: &HashMap, @@ -74,6 +76,7 @@ pub fn get_rpc_key_id_from_params( } } +#[instrument(level = "trace")] pub fn get_chain_id_from_params( app: &Web3ProxyApp, params: &HashMap, @@ -88,6 +91,7 @@ pub fn get_chain_id_from_params( ) } +#[instrument(level = "trace")] pub fn get_query_start_from_params( params: &HashMap, ) -> anyhow::Result { @@ -111,6 +115,7 @@ pub fn get_query_start_from_params( ) } +#[instrument(level = "trace")] pub fn get_page_from_params(params: &HashMap) -> anyhow::Result { params.get("page").map_or_else::, _, _>( || { @@ -127,6 +132,7 @@ pub fn get_page_from_params(params: &HashMap) -> anyhow::Result< ) } +#[instrument(level = "trace")] pub fn get_query_window_seconds_from_params( params: &HashMap, ) -> anyhow::Result { @@ -148,6 +154,7 @@ pub fn get_query_window_seconds_from_params( } /// stats aggregated across a large time period +#[instrument(level = "trace")] pub async fn get_aggregate_rpc_stats_from_params( app: &Web3ProxyApp, bearer: Option>>, @@ -294,6 +301,7 @@ pub async fn get_aggregate_rpc_stats_from_params( } /// stats grouped by key_id and error_repsponse and method and key +#[instrument(level = "trace")] pub async fn get_detailed_stats( app: &Web3ProxyApp, bearer: Option>>,