Bug 1680025 - Disable FOG ping upload in developer builds r=janerik

Differential Revision: https://phabricator.services.mozilla.com/D103937
This commit is contained in:
Chris H-C 2021-02-05 11:08:50 +00:00
parent 8b2a29dfcb
commit 744e23758f
7 changed files with 45 additions and 2 deletions

View File

@ -20,4 +20,7 @@ viaduct = { git = "https://github.com/mozilla/application-services", rev = "8a57
url = "2.1" # Copied from viaduct's deps, see https://github.com/mozilla/application-services/issues/3062
[features]
# Leave data collection enabled, but disable upload.
disable_upload = []
# Letting us know we're compiling with Gecko symbols.
with_gecko = ["fog/with_gecko"]

View File

@ -1,4 +1,4 @@
# Preferences
# Preferences and Defines
## User Preferences
@ -23,6 +23,38 @@ This is how you emulate "recording enabled but upload disabled"
like developer builds have in Firefox Telemetry.
Defaults to 0.
## Defines
`MOZ_GLEAN`
If unset, Glean and FOG are not included in the build.
Only unset on Android at the moment.
This define will likely be removed after we sort out how Android and Geckoview will work
(see [bug 1670261](https://bugzilla.mozilla.org/show_bug.cgi?id=1670261)).
It can be queried in C++ via `#ifdef MOZ_GLEAN`,
in JS via `AppConstants.MOZ_GLEAN`,
and Rust via the `gkrust/glean` feature.
`MOZILLA_OFFICIAL`
If unset, we set a `glean_disable_upload` Rust feature in
`gkrust` and `gkrust-shared` which is forwarded to `fog_control` as `disable_upload`.
This feature defaults FOG to an "upload disabled"
mode where collection on the client proceeds as normal but no ping is sent.
This mode can be overridden at runtime in two ways:
* If the ping has a
[Debug Tag](https://mozilla.github.io/glean/book/user/debugging/index.html)
then it is sent so that it may be inspected in the
[Glean Debug Ping Viewer](https://debug-ping-preview.firebaseapp.com/).
* If the preference `telemetry.fog.test.localhost_port` is set to a value greater than 0,
then pings are sent to a server operating locally at that port
(even if the ping has a Debug Tag), to enable testing.
`MOZILLA_OFFICIAL` tends to be set on most builds released to users,
including builds distributed by Linux distributions.
It tends to not be set on local developer builds.
See [bug 1680025](https://bugzilla.mozilla.org/show_bug.cgi?id=1680025) for details.
`telemetry.fog.test.activity_limit`
`telemetry.fog.test.inactivity_limit`

View File

@ -23,8 +23,11 @@ impl PingUploader for ViaductUploader {
log::trace!("FOG Ping Uploader uploading to {}", url);
let url_clone = url.clone();
let result: std::result::Result<UploadResult, viaduct::Error> = (move || {
let debug_tagged = headers.iter().any(|(name, _)| name == "X-Debug-ID");
let localhost_port = static_prefs::pref!("telemetry.fog.test.localhost_port");
if localhost_port < 0 {
if localhost_port < 0
|| (localhost_port == 0 && !debug_tagged && cfg!(feature = "disable_upload"))
{
log::info!("FOG Ping uploader faking success");
return Ok(UploadResult::HttpStatus(200));
}

View File

@ -31,6 +31,7 @@ wasm_library_sandboxing = ["gkrust-shared/wasm_library_sandboxing"]
webgpu = ["gkrust-shared/webgpu"]
remote_agent = ["gkrust-shared/remote"]
glean = ["gkrust-shared/glean", "fog-gtest"]
glean_disable_upload = ["gkrust-shared/glean_disable_upload"]
glean_with_gecko = ["gkrust-shared/glean_with_gecko", "fog-gtest"]
rust_fxa_client = ["gkrust-shared/rust_fxa_client"]
with_dbus = ["gkrust-shared/with_dbus"]

View File

@ -32,6 +32,7 @@ wasm_library_sandboxing = ["gkrust-shared/wasm_library_sandboxing"]
webgpu = ["gkrust-shared/webgpu"]
remote_agent = ["gkrust-shared/remote"]
glean = ["gkrust-shared/glean"]
glean_disable_upload = ["gkrust-shared/glean_disable_upload"]
glean_with_gecko = ["gkrust-shared/glean_with_gecko"]
rust_fxa_client = ["gkrust-shared/rust_fxa_client"]
with_dbus = ["gkrust-shared/with_dbus"]

View File

@ -76,6 +76,8 @@ if CONFIG['ENABLE_REMOTE_AGENT']:
if CONFIG['MOZ_GLEAN']:
gkrust_features += ['glean', 'glean_with_gecko']
if not CONFIG['MOZILLA_OFFICIAL']:
gkrust_features += ['glean_disable_upload']
if CONFIG['MOZ_RUST_FXA_CLIENT']:
gkrust_features += ['rust_fxa_client']

View File

@ -105,6 +105,7 @@ wasm_library_sandboxing = ["rlbox_lucet_sandbox"]
webgpu = ["wgpu_bindings"]
remote_agent = ["remote"]
glean = ["fog_control"]
glean_disable_upload = ["fog_control/disable_upload"]
glean_with_gecko = ["fog_control/with_gecko"]
rust_fxa_client = ["firefox-accounts-bridge"]
oxidized_breakpad = ["rust_minidump_writer_linux"]