fbwhoami: return a singleton for FbWhoAmI and DynoWhatAmI

Summary: If someone realy doesn't want a singleton then one would need to use FbWhoAmI::parse_from directly, which is fine.

Reviewed By: farnz

Differential Revision: D8556535

fbshipit-source-id: 3f49970b7b9692277932407ca1ec888a0d9458c0
This commit is contained in:
Lukas Piatkowski 2018-06-20 18:20:42 -07:00 committed by Facebook Github Bot
parent 93c181c35d
commit 462d31233f
2 changed files with 1 additions and 7 deletions

View File

@ -20,8 +20,6 @@ extern crate futures_stats;
#[macro_use] #[macro_use]
extern crate futures_trace; extern crate futures_trace;
extern crate itertools; extern crate itertools;
#[macro_use]
extern crate lazy_static;
extern crate tokio; extern crate tokio;
extern crate tokio_core; extern crate tokio_core;
extern crate tokio_io; extern crate tokio_io;

View File

@ -59,10 +59,6 @@ const METAKEYFLAG: &str = "f";
const METAKEYSIZE: &str = "s"; const METAKEYSIZE: &str = "s";
const MAX_NODES_TO_LOG: usize = 5; const MAX_NODES_TO_LOG: usize = 5;
lazy_static! {
static ref WHOAMI: Option<FbWhoAmI> = FbWhoAmI::new().ok();
}
mod ops { mod ops {
pub const HELLO: &str = "hello"; pub const HELLO: &str = "hello";
pub const UNBUNDLE: &str = "unbundle"; pub const UNBUNDLE: &str = "unbundle";
@ -235,7 +231,7 @@ fn add_common_stats_and_send_to_scuba(
sample.add("args", args); sample.add("args", args);
} }
if let &Some(ref whoami) = &*WHOAMI { if let Ok(whoami) = FbWhoAmI::new() {
if let Some(hostname) = whoami.get_name() { if let Some(hostname) = whoami.get_name() {
sample.add("server_hostname", hostname); sample.add("server_hostname", hostname);
} }