Bug 1197292 - Read delays from prefs, backup to defaults if not set. Shorter delays are useful to accelerate test cycles. r=gfritzsche

This commit is contained in:
André Reinald 2015-08-24 16:50:51 +02:00
parent 98cd6dc706
commit 9779f5952d
3 changed files with 37 additions and 8 deletions

View File

@ -53,7 +53,7 @@ const IS_UNIFIED_OPTIN = Preferences.get(PREF_UNIFIED_OPTIN, false);
const PING_FORMAT_VERSION = 4;
// Delay before intializing telemetry (ms)
const TELEMETRY_DELAY = 60000;
const TELEMETRY_DELAY = Preferences.get("toolkit.telemetry.initDelay", 60) * 1000;
// Delay before initializing telemetry if we're testing (ms)
const TELEMETRY_TEST_DELAY = 100;

View File

@ -44,7 +44,7 @@ const REASON_SHUTDOWN = "shutdown";
const ENVIRONMENT_CHANGE_LISTENER = "TelemetrySession::onEnvironmentChange";
const MS_IN_ONE_HOUR = 60 * 60 * 1000;
const MIN_SUBSESSION_LENGTH_MS = 10 * 60 * 1000;
const MIN_SUBSESSION_LENGTH_MS = Preferences.get("toolkit.telemetry.minSubsessionLength", 10 * 60) * 1000;
// This is the HG changeset of the Histogram.json file, used to associate
// submitted ping data with its histogram definition (bug 832007)
@ -75,16 +75,16 @@ const IS_UNIFIED_TELEMETRY = Preferences.get(PREF_UNIFIED, false);
// Maximum number of content payloads that we are willing to store.
const MAX_NUM_CONTENT_PAYLOADS = 10;
// Do not gather data more than once a minute
const TELEMETRY_INTERVAL = 60000;
// Do not gather data more than once a minute (ms)
const TELEMETRY_INTERVAL = 60 * 1000;
// Delay before intializing telemetry (ms)
const TELEMETRY_DELAY = 60000;
const TELEMETRY_DELAY = Preferences.get("toolkit.telemetry.initDelay", 60) * 1000;
// Delay before initializing telemetry if we're testing (ms)
const TELEMETRY_TEST_DELAY = 100;
// Execute a scheduler tick every 5 minutes.
const SCHEDULER_TICK_INTERVAL_MS = 5 * 60 * 1000;
const SCHEDULER_TICK_INTERVAL_MS = Preferences.get("toolkit.telemetry.scheduler.tickInterval", 5 * 60) * 1000;
// When user is idle, execute a scheduler tick every 60 minutes.
const SCHEDULER_TICK_IDLE_INTERVAL_MS = 60 * 60 * 1000;
const SCHEDULER_TICK_IDLE_INTERVAL_MS = Preferences.get("toolkit.telemetry.scheduler.idleTickInterval", 60 * 60) * 1000;
// The tolerance we have when checking if it's midnight (15 minutes).
const SCHEDULER_MIDNIGHT_TOLERANCE_MS = 15 * 60 * 1000;
@ -92,7 +92,7 @@ const SCHEDULER_MIDNIGHT_TOLERANCE_MS = 15 * 60 * 1000;
// Seconds of idle time before pinging.
// On idle-daily a gather-telemetry notification is fired, during it probes can
// start asynchronous tasks to gather data.
const IDLE_TIMEOUT_SECONDS = 5 * 60;
const IDLE_TIMEOUT_SECONDS = Preferences.get("toolkit.telemetry.idleTimeout", 5 * 60);
// The frequency at which we persist session data to the disk to prevent data loss
// in case of aborted sessions (currently 5 minutes).

View File

@ -94,3 +94,32 @@ Data-choices notification
``datareporting.policy.minimumPolicyVersion.channel-NAME``
This is the only channel-specific version that we currently use for the minimum policy version.
Testing
-------
The following prefs are for testing purpose only.
``toolkit.telemetry.initDelay``
Delay before initializing telemetry (seconds).
``toolkit.telemetry.minSubsessionLength``
Minimum length of a telemetry subsession (seconds).
``toolkit.telemetry.collectInterval``
Minimum interval between data collection (seconds).
``toolkit.telemetry.scheduler.tickInterval``
Interval between scheduler ticks (seconds).
``toolkit.telemetry.scheduler.idleTickInterval``
Interval between scheduler ticks when the user is idle (seconds).
``toolkit.telemetry.idleTimeout``
Timeout until we decide whether a user is idle or not (seconds).