Created
November 28, 2019 16:02
-
-
Save badboy/ec37378e6462384ebc8b5b49f9fa6d25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::env; | |
use once_cell::sync::Lazy; | |
use tempfile::Builder; | |
use glean_preview::{Glean, Configuration, Error, metrics::PingType}; | |
#[allow(non_upper_case_globals)] | |
pub static PrototypePing: Lazy<PingType> = Lazy::new(|| { | |
PingType::new("prototype", true) | |
}); | |
fn main() -> Result<(), Error> { | |
env_logger::init(); | |
let mut args = env::args().skip(1); | |
let data_path = if let Some(path) = args.next() { | |
path | |
} else { | |
let root = Builder::new().prefix("simple-db").tempdir().unwrap(); | |
root.path().display().to_string() | |
}; | |
let cfg = Configuration { | |
data_path, | |
application_id: "org.mozilla.glean_core.example".into(), | |
upload_enabled: true, | |
max_events: None, | |
}; | |
Glean::initialize(cfg)?; | |
if let true = PrototypePing.send()? { | |
log::info!("Successfully collected a prototype ping"); | |
} else { | |
log::info!("Prototype ping failed"); | |
} | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment