зеркало из https://github.com/mozilla/glean.git
Add smoke values for common fields to make valid pings
This commit is contained in:
Родитель
e63c63e8be
Коммит
db693d7202
|
@ -3,7 +3,7 @@ use super::{metrics::*, CommonMetricData, Lifetime};
|
|||
#[derive(Debug)]
|
||||
pub struct CoreMetrics {
|
||||
pub client_id: UuidMetric,
|
||||
pub first_run: BooleanMetric,
|
||||
pub first_run_date: StringMetric,
|
||||
}
|
||||
|
||||
impl CoreMetrics {
|
||||
|
@ -13,15 +13,16 @@ impl CoreMetrics {
|
|||
name: "client_id".into(),
|
||||
category: "".into(),
|
||||
send_in_pings: vec!["glean_client_info".into()],
|
||||
lifetime: Lifetime::Application,
|
||||
lifetime: Lifetime::User,
|
||||
disabled: false,
|
||||
}),
|
||||
|
||||
first_run: BooleanMetric::new(CommonMetricData {
|
||||
name: "first_run".into(),
|
||||
// TODO: this should really be a "DatetimeType".
|
||||
first_run_date: StringMetric::new(CommonMetricData {
|
||||
name: "first_run_date".into(),
|
||||
category: "".into(),
|
||||
send_in_pings: vec!["glean_client_info".into()],
|
||||
lifetime: Lifetime::Application,
|
||||
lifetime: Lifetime::User,
|
||||
disabled: false,
|
||||
}),
|
||||
}
|
||||
|
|
|
@ -62,9 +62,11 @@ impl Glean {
|
|||
}
|
||||
|
||||
fn initialize_core_metrics(&mut self, data_path: &str) {
|
||||
self.core_metrics
|
||||
.first_run
|
||||
.set(self, first_run::is_first_run(data_path));
|
||||
if first_run::is_first_run(data_path) {
|
||||
self.core_metrics
|
||||
.first_run_date
|
||||
.set(self, "2019-05-09-04:00");
|
||||
}
|
||||
self.core_metrics.client_id.generate_if_missing(self);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,12 +42,18 @@ impl PingMaker {
|
|||
json!({
|
||||
"ping_type": storage_name,
|
||||
"seq": self.get_ping_seq(storage_name),
|
||||
"start_time": "2019-03-29T09:50-04:00",
|
||||
"end_time": "2019-03-29T09:53-04:00"
|
||||
})
|
||||
}
|
||||
|
||||
fn get_client_info(&self, storage: &Database) -> JsonValue {
|
||||
let client_info = StorageManager.snapshot_as_json(storage, "glean_client_info", true);
|
||||
let mut map = json!({});
|
||||
// Add the "telemetry_sdk_build", which is the glean-core version.
|
||||
let version = env!("CARGO_PKG_VERSION");
|
||||
let mut map = json!({
|
||||
"telemetry_sdk_build": version,
|
||||
});
|
||||
|
||||
// Flatten the whole thing.
|
||||
let client_info_obj = client_info.as_object().unwrap(); // safe, snapshot always returns an object.
|
||||
|
|
Загрузка…
Ссылка в новой задаче