add hostname to status
This commit is contained in:
parent
a69737db98
commit
c0afc295ca
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -5814,6 +5814,7 @@ dependencies = [
|
||||
"handlebars",
|
||||
"hashbrown 0.13.2",
|
||||
"hdrhistogram",
|
||||
"hostname",
|
||||
"http",
|
||||
"ipnet",
|
||||
"itertools",
|
||||
|
@ -45,6 +45,7 @@ handlebars = "4.3.6"
|
||||
hashbrown = { version = "0.13.2", features = ["serde"] }
|
||||
hdrhistogram = "7.5.2"
|
||||
http = "0.2.9"
|
||||
hostname = "0.3.1"
|
||||
ipnet = "2.7.1"
|
||||
itertools = "0.10.5"
|
||||
log = "0.4.17"
|
||||
|
@ -44,6 +44,7 @@ use redis_rate_limiter::{redis, DeadpoolRuntime, RedisConfig, RedisPool, RedisRa
|
||||
use serde::Serialize;
|
||||
use serde_json::json;
|
||||
use serde_json::value::to_raw_value;
|
||||
use std::ffi::OsString;
|
||||
use std::fmt;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::net::IpAddr;
|
||||
@ -213,6 +214,7 @@ pub struct Web3ProxyApp {
|
||||
pub config: AppConfig,
|
||||
pub db_conn: Option<sea_orm::DatabaseConnection>,
|
||||
pub db_replica: Option<DatabaseReplica>,
|
||||
pub hostname: Option<OsString>,
|
||||
/// store pending transactions that we've seen so that we don't send duplicates to subscribers
|
||||
pub pending_transactions: Cache<TxHash, TxStatus, hashbrown::hash_map::DefaultHashBuilder>,
|
||||
pub frontend_ip_rate_limiter: Option<DeferredRateLimiter<IpAddr>>,
|
||||
@ -694,6 +696,8 @@ impl Web3ProxyApp {
|
||||
Some(private_rpcs)
|
||||
};
|
||||
|
||||
let hostname = hostname::get().ok();
|
||||
|
||||
let app = Self {
|
||||
config: top_config.app.clone(),
|
||||
balanced_rpcs,
|
||||
@ -709,6 +713,7 @@ impl Web3ProxyApp {
|
||||
login_rate_limiter,
|
||||
db_conn,
|
||||
db_replica,
|
||||
hostname,
|
||||
vredis_pool,
|
||||
rpc_secret_key_cache,
|
||||
bearer_token_semaphores,
|
||||
|
@ -40,11 +40,13 @@ pub async fn status(
|
||||
let body = response_cache
|
||||
.get_with(FrontendResponseCaches::Status, async {
|
||||
// TODO: what else should we include? uptime, cache hit rates, cpu load, memory used
|
||||
// TODO: the hostname is probably not going to change. only get once at the start?
|
||||
let body = json!({
|
||||
"version": APP_USER_AGENT,
|
||||
"chain_id": app.config.chain_id,
|
||||
"balanced_rpcs": app.balanced_rpcs,
|
||||
"private_rpcs": app.private_rpcs,
|
||||
"hostname": app.hostname,
|
||||
});
|
||||
|
||||
Arc::new(body)
|
||||
|
Loading…
Reference in New Issue
Block a user