@@ -10,11 +10,11 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
env_logger = "0.7.1"
|
||||
gethostname = "0.2.1"
|
||||
lazy_static = "1.4.0"
|
||||
log = "0.4.8"
|
||||
reqwest = { version = "0.10.1", default-features = false, features = ["blocking", "rustls-tls"] }
|
||||
solana-sdk = { path = "../sdk", version = "1.0.9" }
|
||||
sys-info = "0.5.9"
|
||||
|
||||
[dev-dependencies]
|
||||
rand = "0.6.5"
|
||||
|
@@ -1,6 +1,7 @@
|
||||
//! The `metrics` module enables sending measurements to an `InfluxDB` instance
|
||||
|
||||
use crate::{counter::CounterPoint, datapoint::DataPoint};
|
||||
use gethostname::gethostname;
|
||||
use lazy_static::lazy_static;
|
||||
use log::*;
|
||||
use solana_sdk::hash::hash;
|
||||
@@ -11,7 +12,6 @@ use std::sync::{Arc, Barrier, Mutex, Once, RwLock};
|
||||
use std::thread;
|
||||
use std::time::{Duration, Instant};
|
||||
use std::{cmp, env};
|
||||
use sys_info::hostname;
|
||||
|
||||
type CounterMap = HashMap<(&'static str, u64), CounterPoint>;
|
||||
|
||||
@@ -317,7 +317,9 @@ fn get_singleton_agent() -> Arc<Mutex<MetricsAgent>> {
|
||||
lazy_static! {
|
||||
static ref HOST_ID: Arc<RwLock<String>> = {
|
||||
Arc::new(RwLock::new({
|
||||
let hostname: String = hostname().unwrap_or_else(|_| "".to_string());
|
||||
let hostname: String = gethostname()
|
||||
.into_string()
|
||||
.unwrap_or_else(|_| "".to_string());
|
||||
format!("{}", hash(hostname.as_bytes()))
|
||||
}))
|
||||
};
|
||||
|
Reference in New Issue
Block a user