diff --git a/configuration/example.config.toml b/configuration/example.config.toml index c48d7194..63b8c98d 100644 --- a/configuration/example.config.toml +++ b/configuration/example.config.toml @@ -115,7 +115,7 @@ near_rpc_url = "https://beta.rpc.mainnet.near.org" ### Lake framework configuration [lake_config] -# Number of threads to use for fetching data from fatnear +# Number of threads to use for fetching data from fastnear # Default: 2 * available threads #num_threads = 8 diff --git a/rpc-server/src/metrics.rs b/rpc-server/src/metrics.rs index 206f3509..7c006cd8 100644 --- a/rpc-server/src/metrics.rs +++ b/rpc-server/src/metrics.rs @@ -113,6 +113,11 @@ lazy_static! { "Optimistic updating status. 0: working, 1: not working", ).unwrap(); + pub(crate) static ref CURRENT_PROTOCOL_VERSION: IntGauge = try_create_int_gauge( + "current_protocol_version", + "Current protocol version", + ).unwrap(); + pub(crate) static ref LEGACY_DATABASE_TX_DETAILS: IntCounterVec = register_int_counter_vec( "legacy_database_tx_details", "Total number of calls to the legacy database for transaction details", diff --git a/rpc-server/src/utils.rs b/rpc-server/src/utils.rs index 37da909c..4b849efe 100644 --- a/rpc-server/src/utils.rs +++ b/rpc-server/src/utils.rs @@ -149,7 +149,9 @@ pub async fn get_current_protocol_version( near_rpc_client: &JsonRpcClient, ) -> anyhow::Result { let params = near_jsonrpc_client::methods::status::RpcStatusRequest; - Ok(near_rpc_client.call(params, None).await?.protocol_version) + let protocol_version = near_rpc_client.call(params, None).await?.protocol_version; + crate::metrics::CURRENT_PROTOCOL_VERSION.set(protocol_version as i64); + Ok(protocol_version) } async fn handle_streamer_message( @@ -205,7 +207,7 @@ pub async fn update_final_block_regularly( ) .await { - tracing::error!("Error to handle_streamer_message: {:?}", err); + tracing::error!("Error in fn handle_streamer_message(): {:?}", err); }; // Sleep for 500ms before the next iteration tokio::time::sleep(std::time::Duration::from_millis(500)).await;