зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1591564 - Determine from the pref whether Glean upload is enabled r=janerik,emilio
Since we're the only one sending data, and we're doing so infrequently, let's get the pref value before each ping send instead of building a pref observer right this second. Differential Revision: https://phabricator.services.mozilla.com/D57107 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
fa1be025f2
Коммит
94d6ae235a
|
@ -1183,6 +1183,7 @@ dependencies = [
|
|||
"glean-preview 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nserror 0.1.0",
|
||||
"nsstring 0.1.0",
|
||||
"static_prefs 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -1190,6 +1190,16 @@
|
|||
value: 0
|
||||
mirror: always
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "datareporting."
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
- name: datareporting.healthreport.uploadEnabled
|
||||
type: RelaxedAtomicBool
|
||||
value: false
|
||||
mirror: always
|
||||
rust: true
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "device."
|
||||
#---------------------------------------------------------------------------
|
||||
|
|
|
@ -34,6 +34,7 @@ pref_groups = [
|
|||
'channelclassifier',
|
||||
'clipboard',
|
||||
'content',
|
||||
'datareporting',
|
||||
'device',
|
||||
'devtools',
|
||||
'docshell',
|
||||
|
|
|
@ -1171,7 +1171,7 @@ TelemetryImpl::GetIsOfficialTelemetry(bool* ret) {
|
|||
// C functions with the "fog_" prefix.
|
||||
// See toolkit/components/telemetry/fog/*.
|
||||
extern "C" {
|
||||
nsresult fog_init(bool useTelemetry, const nsAString* dataDir);
|
||||
nsresult fog_init(const nsAString* dataDir);
|
||||
}
|
||||
|
||||
static void internal_initFogotype(bool aUseTelemetry) {
|
||||
|
@ -1187,7 +1187,7 @@ static void internal_initFogotype(bool aUseTelemetry) {
|
|||
NS_WARNING("Couldn't get data path. Bailing on FOGotype.");
|
||||
return;
|
||||
}
|
||||
NS_WARN_IF(NS_FAILED(fog_init(aUseTelemetry, &path)));
|
||||
NS_WARN_IF(NS_FAILED(fog_init(&path)));
|
||||
}
|
||||
#endif // defined(MOZ_FOGOTYPE)
|
||||
|
||||
|
|
|
@ -11,3 +11,4 @@ license = "MPL-2.0"
|
|||
glean-preview = "0.0.2"
|
||||
nserror = { path = "../../../../xpcom/rust/nserror" }
|
||||
nsstring = { path = "../../../../xpcom/rust/nsstring" }
|
||||
static_prefs = { path = "../../../../modules/libpref/init/static_prefs" }
|
||||
|
|
|
@ -11,7 +11,10 @@ use std::io::Error;
|
|||
use std::thread::JoinHandle;
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn fog_init(upload_enabled: bool, data_dir: &nsAString) -> nsresult {
|
||||
pub unsafe extern "C" fn fog_init(data_dir: &nsAString) -> nsresult {
|
||||
|
||||
let upload_enabled = static_prefs::pref!("datareporting.healthreport.uploadEnabled");
|
||||
|
||||
let cfg = Configuration {
|
||||
data_path: data_dir.to_string(),
|
||||
application_id: "org.mozilla.fogotype".into(),
|
||||
|
@ -41,6 +44,8 @@ fn prototype_ping_init() -> Result<JoinHandle<()>, Error> {
|
|||
let an_hour = time::Duration::from_secs(60 * 60);
|
||||
loop {
|
||||
thread::sleep(an_hour);
|
||||
let upload_enabled = static_prefs::pref!("datareporting.healthreport.uploadEnabled");
|
||||
glean_preview::set_upload_enabled(upload_enabled);
|
||||
prototype_ping.send();
|
||||
}
|
||||
})
|
||||
|
|
Загрузка…
Ссылка в новой задаче