Fix windows build by removing sys-info (#8860)

Doesn't build for windows.
This commit is contained in:
sakridge
2020-03-16 12:53:13 -07:00
committed by GitHub
parent 0641244378
commit 7079559c2d
10 changed files with 25 additions and 25 deletions

View File

@ -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.4", default-features = false, features = ["blocking", "rustls-tls", "json"] }
solana-sdk = { path = "../sdk", version = "1.1.0" }
sys-info = "0.5.10"
[dev-dependencies]
rand = "0.6.5"

View File

@ -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()))
}))
};