forked from mirrors/gecko-dev
Bug 1900085 - Disable builtin Glean pings during tests r=TravisLong,perftest-reviewers,sparky,search-reviewers,jteow
This patch specifically disables "baseline" and "events" pings through not telling Glean about user (in)activity, which triggers their submission. "baseline" should matter less, but if an "events" ping is submitted during a test it could contain a test's recorded events that it will later want to assert are present. "metrics" pings are already suppressed in automation via the `MOZ_AUTOMATION` envvar. So update the docs to note that. "deletion-request" pings are permitted at all times for all reasons and are not included in the builtin pings we're disabling. Differential Revision: https://phabricator.services.mozilla.com/D212315
This commit is contained in:
parent
95b1b0b526
commit
a5e9670ef6
12 changed files with 46 additions and 8 deletions
|
|
@ -82,7 +82,10 @@ add_setup(async function () {
|
|||
let promise = waitForDomainToCategoriesUpdate();
|
||||
await insertRecordIntoCollectionAndSync();
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.search.serpEventTelemetryCategorization.enabled", true]],
|
||||
set: [
|
||||
["browser.search.serpEventTelemetryCategorization.enabled", true],
|
||||
["telemetry.fog.test.activity_limit", 120],
|
||||
],
|
||||
});
|
||||
await promise;
|
||||
|
||||
|
|
|
|||
|
|
@ -15343,13 +15343,13 @@
|
|||
rust: true
|
||||
|
||||
- name: telemetry.fog.test.activity_limit
|
||||
type: RelaxedAtomicUint32
|
||||
type: RelaxedAtomicInt32
|
||||
value: 120
|
||||
mirror: always
|
||||
rust: true
|
||||
|
||||
- name: telemetry.fog.test.inactivity_limit
|
||||
type: RelaxedAtomicUint32
|
||||
type: RelaxedAtomicInt32
|
||||
value: 1200
|
||||
mirror: always
|
||||
rust: true
|
||||
|
|
|
|||
|
|
@ -161,6 +161,11 @@ int RunGTestFunc(int* argc, char** argv) {
|
|||
// However, at init, Glean may decide to send a ping. So let's first tell FOG
|
||||
// that these pings shouldn't actually be uploaded.
|
||||
Preferences::SetInt("telemetry.fog.test.localhost_port", -1);
|
||||
// Though the default user-activity limits ought to be longer than a test,
|
||||
// ensure that they don't trigger unnecessary ping submission (which clears
|
||||
// storage, making it hard to test instrumentation).
|
||||
Preferences::SetInt("telemetry.fog.test.activity_limit", -1);
|
||||
Preferences::SetInt("telemetry.fog.test.inactivity_limit", -1);
|
||||
const nsCString empty;
|
||||
RefPtr<FOG>(FOG::GetSingleton())->InitializeFOG(empty, empty, false);
|
||||
|
||||
|
|
|
|||
|
|
@ -79,9 +79,12 @@ user_pref("browser.newtabpage.activity-stream.discoverystream.region-weather-con
|
|||
user_pref("browser.newtabpage.activity-stream.newtabWallpapers.enabled", false);
|
||||
// Don't pull sponsored Top Sites content from the network
|
||||
user_pref("browser.newtabpage.activity-stream.showSponsoredTopSites", false);
|
||||
// Default Glean to "record but don't report" mode. Docs:
|
||||
// Default Glean to "record but don't report" mode, and to never trigger
|
||||
// activity-based ping submission. Docs:
|
||||
// https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/preferences.html
|
||||
user_pref("telemetry.fog.test.localhost_port", -1);
|
||||
user_pref("telemetry.fog.test.activity_limit", -1);
|
||||
user_pref("telemetry.fog.test.inactivity_limit", -1);
|
||||
// Disable overlay scrollbars on GTK for testing. A bunch of tests (specially
|
||||
// mochitests) assume scrollbars take space. We disable them on macOS (where
|
||||
// overlay is also the default) at the system level as well, so this is
|
||||
|
|
|
|||
|
|
@ -79,7 +79,12 @@ user_pref("security.enable_java", false);
|
|||
user_pref("security.external_protocol_requires_permission", false);
|
||||
user_pref("security.fileuri.strict_origin_policy", false);
|
||||
user_pref("toolkit.telemetry.server", "https://127.0.0.1/telemetry-dummy/");
|
||||
// Default Glean to "record but don't report" mode, and to never trigger
|
||||
// activity-based ping submission. Docs:
|
||||
// https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/preferences.html
|
||||
user_pref("telemetry.fog.test.localhost_port", -1);
|
||||
user_pref("telemetry.fog.test.activity_limit", -1);
|
||||
user_pref("telemetry.fog.test.inactivity_limit", -1);
|
||||
// The telemetry system sometimes uses a separate program to send telemetry
|
||||
// pings, particularly in the case when Firefox is shutting down. The prefs above
|
||||
// prevent telemetry from being sent anywhere useful, but even so the process would
|
||||
|
|
|
|||
|
|
@ -13,7 +13,12 @@ user_pref("browser.cache.disk.smart_size.enabled", true);
|
|||
user_pref("extensions.webextensions.warnings-as-errors", false);
|
||||
// disable telemetry bug 1639148
|
||||
user_pref("toolkit.telemetry.server", "");
|
||||
// Default Glean to "record but don't report" mode, and to never trigger
|
||||
// activity-based ping submission. Docs:
|
||||
// https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/preferences.html
|
||||
user_pref("telemetry.fog.test.localhost_port", -1);
|
||||
user_pref("telemetry.fog.test.activity_limit", -1);
|
||||
user_pref("telemetry.fog.test.inactivity_limit", -1);
|
||||
|
||||
// Turn off update
|
||||
user_pref("app.update.disabledForTesting", true);
|
||||
|
|
|
|||
|
|
@ -85,7 +85,12 @@ user_pref("testing.supports.moz-bool-pref", false);
|
|||
// server in the middle of the tests.
|
||||
user_pref("toolkit.telemetry.enabled", false);
|
||||
user_pref("toolkit.telemetry.server", "https://%(server)s/telemetry-dummy/");
|
||||
// Default Glean to "record but don't report" mode, and to never trigger
|
||||
// activity-based ping submission. Docs:
|
||||
// https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/preferences.html
|
||||
user_pref("telemetry.fog.test.localhost_port", -1);
|
||||
user_pref("telemetry.fog.test.activity_limit", -1);
|
||||
user_pref("telemetry.fog.test.inactivity_limit", -1);
|
||||
user_pref("ui.caretBlinkTime", -1);
|
||||
user_pref("ui.caretWidth", 1);
|
||||
user_pref("ui.prefersReducedMotion", 0);
|
||||
|
|
|
|||
|
|
@ -202,7 +202,12 @@ user_pref("toolkit.telemetry.firstShutdownPing.enabled", false);
|
|||
user_pref("toolkit.telemetry.newProfilePing.enabled", false);
|
||||
// We want to collect telemetry, but we don't want to send in the results.
|
||||
user_pref("toolkit.telemetry.server", "https://{server}/telemetry-dummy/");
|
||||
// Default Glean to "record but don't report" mode, and to never trigger
|
||||
// activity-based ping submission. Docs:
|
||||
// https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/preferences.html
|
||||
user_pref("telemetry.fog.test.localhost_port", -1);
|
||||
user_pref("telemetry.fog.test.activity_limit", -1);
|
||||
user_pref("telemetry.fog.test.inactivity_limit", -1);
|
||||
// Don't send the 'shutdown' ping using the pingsender on the first session using
|
||||
// the 'pingsender' process. Valgrind marks the process as leaky (e.g. see bug 1364068
|
||||
// for the 'new-profile' ping) but does not provide enough information
|
||||
|
|
|
|||
|
|
@ -18,7 +18,12 @@ user_pref("geo.provider.network.compare.url", "");
|
|||
user_pref("media.gmp-manager.updateEnabled", false);
|
||||
user_pref("media.gmp-manager.url.override", "http://%(server)s/dummy-gmp-manager.xml");
|
||||
user_pref("toolkit.telemetry.server", "https://%(server)s/telemetry-dummy");
|
||||
// Default Glean to "record but don't report" mode, and to never trigger
|
||||
// activity-based ping submission. Docs:
|
||||
// https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/preferences.html
|
||||
user_pref("telemetry.fog.test.localhost_port", -1);
|
||||
user_pref("telemetry.fog.test.activity_limit", -1);
|
||||
user_pref("telemetry.fog.test.inactivity_limit", -1);
|
||||
// Prevent Remote Settings to issue non local connections.
|
||||
user_pref("services.settings.server", "data:,#remote-settings-dummy/v1");
|
||||
// Prevent intermediate preloads to be downloaded on Remote Settings polling.
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ This pair of prefs control the length of time of activity before inactivity
|
|||
needed before FOG informs the SDK's Client Activity API that the client was (in)active.
|
||||
Present to allow testing without figuring out how to mock Rust's clock.
|
||||
Their values are integer seconds.
|
||||
The value `-1` is treated as no limit (never trigger (in)activity).
|
||||
Defaults to 120 (activity), 1200 (inactivity).
|
||||
|
||||
## Internal Preferences
|
||||
|
|
@ -51,7 +52,7 @@ If true, [JOG](./jog) is enabled so that artifact builds will exhibit changes to
|
|||
|
||||
If set, and `GLEAN_SOURCE_TAGS` isn't set, FOG will set a
|
||||
[Glean source tag](https://mozilla.github.io/glean/book/reference/debug/sourceTags.html)
|
||||
of `automation`.
|
||||
of `automation` and FOG will disable the submission of "metrics" pings.
|
||||
|
||||
If `GLEAN_SOURCE_TAGS` is set, the `automation` source tag will not be added automatically.
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ To run all the things, here's the tl;dr:
|
|||
&& python3 ./mach python-test toolkit/components/glean/tests/pytest
|
||||
&& ./mach test toolkit/components/glean/tests/xpcshell
|
||||
&& ./mach telemetry-tests-client toolkit/components/telemetry/tests/marionette/tests/client/test_fog* --gecko-log "-"
|
||||
&& ./mach test toolkit/components/glean/tests/browser
|
||||
&& ./mach test toolkit/components/glean/tests/browser --headless
|
||||
`
|
||||
|
||||
## Logging
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
use std::convert::TryInto;
|
||||
use std::ffi::CStr;
|
||||
use std::os::raw::c_char;
|
||||
use std::sync::{
|
||||
|
|
@ -90,7 +91,7 @@ impl UserActivityObserver {
|
|||
.elapsed();
|
||||
// We only care after a certain period of inactivity (default 20min).
|
||||
let limit = static_prefs::pref!("telemetry.fog.test.inactivity_limit");
|
||||
if inactivity >= Duration::from_secs(limit.into()) {
|
||||
if limit >= 0 && inactivity >= Duration::from_secs(limit.try_into().unwrap_or(0)) {
|
||||
log::info!(
|
||||
"User triggers core activity after {}s!",
|
||||
inactivity.as_secs()
|
||||
|
|
@ -114,7 +115,7 @@ impl UserActivityObserver {
|
|||
.elapsed();
|
||||
// We only care after a certain period of activity (default 2min).
|
||||
let limit = static_prefs::pref!("telemetry.fog.test.activity_limit");
|
||||
if activity >= Duration::from_secs(limit.into()) {
|
||||
if limit >= 0 && activity >= Duration::from_secs(limit.try_into().unwrap_or(0)) {
|
||||
log::info!(
|
||||
"User triggers core inactivity after {}s!",
|
||||
activity.as_secs()
|
||||
|
|
|
|||
Loading…
Reference in a new issue