mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +03:00
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:
parent
93c181c35d
commit
462d31233f
@ -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;
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user