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",
|
"handlebars",
|
||||||
"hashbrown 0.13.2",
|
"hashbrown 0.13.2",
|
||||||
"hdrhistogram",
|
"hdrhistogram",
|
||||||
|
"hostname",
|
||||||
"http",
|
"http",
|
||||||
"ipnet",
|
"ipnet",
|
||||||
"itertools",
|
"itertools",
|
||||||
|
@ -45,6 +45,7 @@ handlebars = "4.3.6"
|
|||||||
hashbrown = { version = "0.13.2", features = ["serde"] }
|
hashbrown = { version = "0.13.2", features = ["serde"] }
|
||||||
hdrhistogram = "7.5.2"
|
hdrhistogram = "7.5.2"
|
||||||
http = "0.2.9"
|
http = "0.2.9"
|
||||||
|
hostname = "0.3.1"
|
||||||
ipnet = "2.7.1"
|
ipnet = "2.7.1"
|
||||||
itertools = "0.10.5"
|
itertools = "0.10.5"
|
||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
|
@ -44,6 +44,7 @@ use redis_rate_limiter::{redis, DeadpoolRuntime, RedisConfig, RedisPool, RedisRa
|
|||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use serde_json::value::to_raw_value;
|
use serde_json::value::to_raw_value;
|
||||||
|
use std::ffi::OsString;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
@ -213,6 +214,7 @@ pub struct Web3ProxyApp {
|
|||||||
pub config: AppConfig,
|
pub config: AppConfig,
|
||||||
pub db_conn: Option<sea_orm::DatabaseConnection>,
|
pub db_conn: Option<sea_orm::DatabaseConnection>,
|
||||||
pub db_replica: Option<DatabaseReplica>,
|
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
|
/// 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 pending_transactions: Cache<TxHash, TxStatus, hashbrown::hash_map::DefaultHashBuilder>,
|
||||||
pub frontend_ip_rate_limiter: Option<DeferredRateLimiter<IpAddr>>,
|
pub frontend_ip_rate_limiter: Option<DeferredRateLimiter<IpAddr>>,
|
||||||
@ -694,6 +696,8 @@ impl Web3ProxyApp {
|
|||||||
Some(private_rpcs)
|
Some(private_rpcs)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let hostname = hostname::get().ok();
|
||||||
|
|
||||||
let app = Self {
|
let app = Self {
|
||||||
config: top_config.app.clone(),
|
config: top_config.app.clone(),
|
||||||
balanced_rpcs,
|
balanced_rpcs,
|
||||||
@ -709,6 +713,7 @@ impl Web3ProxyApp {
|
|||||||
login_rate_limiter,
|
login_rate_limiter,
|
||||||
db_conn,
|
db_conn,
|
||||||
db_replica,
|
db_replica,
|
||||||
|
hostname,
|
||||||
vredis_pool,
|
vredis_pool,
|
||||||
rpc_secret_key_cache,
|
rpc_secret_key_cache,
|
||||||
bearer_token_semaphores,
|
bearer_token_semaphores,
|
||||||
|
@ -40,11 +40,13 @@ pub async fn status(
|
|||||||
let body = response_cache
|
let body = response_cache
|
||||||
.get_with(FrontendResponseCaches::Status, async {
|
.get_with(FrontendResponseCaches::Status, async {
|
||||||
// TODO: what else should we include? uptime, cache hit rates, cpu load, memory used
|
// 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!({
|
let body = json!({
|
||||||
"version": APP_USER_AGENT,
|
"version": APP_USER_AGENT,
|
||||||
"chain_id": app.config.chain_id,
|
"chain_id": app.config.chain_id,
|
||||||
"balanced_rpcs": app.balanced_rpcs,
|
"balanced_rpcs": app.balanced_rpcs,
|
||||||
"private_rpcs": app.private_rpcs,
|
"private_rpcs": app.private_rpcs,
|
||||||
|
"hostname": app.hostname,
|
||||||
});
|
});
|
||||||
|
|
||||||
Arc::new(body)
|
Arc::new(body)
|
||||||
|
Loading…
Reference in New Issue
Block a user