Bug 1469233 - remove pingsOverdue from simpleMeasurements; r=Dexter

pingsOverdue is a telemetry-specific data field that is not used anymore.
Therefore it is being removed from both the docs and TelemetrySession.jsm

The logic that exports and computes the overdue pings count, and all related
code, is also removed.

Associated test failure (due to performing the above) is fixed by removing the
offending test code.

MozReview-Commit-ID: DZUapvZbC9U

--HG--
extra : rebase_source : b5207495f19d23d0a9f57ba62a8c6c6872958b49
This commit is contained in:
Arjun Krishna Babu 2018-06-20 18:51:09 +05:30
parent 5de0228062
commit 7a3711075a
4 changed files with 3 additions and 81 deletions

View File

@ -82,9 +82,6 @@ const SEND_TICK_DELAY = 1 * MS_IN_A_MINUTE;
// This exponential backoff will be reset by external ping submissions & idle-daily.
const SEND_MAXIMUM_BACKOFF_DELAY_MS = 120 * MS_IN_A_MINUTE;
// The age of a pending ping to be considered overdue (in milliseconds).
const OVERDUE_PING_FILE_AGE = 7 * 24 * 60 * MS_IN_A_MINUTE; // 1 week
// Strings to map from XHR.errorCode to TELEMETRY_SEND_FAILURE_TYPE.
// Echoes XMLHttpRequestMainThread's ErrorType enum.
// Make sure that any additions done to XHR_ERROR_TYPE enum are also mirrored in
@ -176,13 +173,6 @@ function gzipCompressString(string) {
var TelemetrySend = {
/**
* Age in ms of a pending ping to be considered overdue.
*/
get OVERDUE_PING_FILE_AGE() {
return OVERDUE_PING_FILE_AGE;
},
get pendingPingCount() {
return TelemetrySendImpl.pendingPingCount;
},
@ -231,13 +221,6 @@ var TelemetrySend = {
return TelemetrySendImpl.submitPing(ping, options);
},
/**
* Count of pending pings that were found to be overdue at startup.
*/
get overduePingsCount() {
return TelemetrySendImpl.overduePingsCount;
},
/**
* Notify that we can start submitting data to the servers.
*/
@ -597,8 +580,6 @@ var TelemetrySendImpl = {
_currentPings: new Map(),
// Used to skip spawning the pingsender if OS is shutting down.
_isOSShutdown: false,
// Count of pending pings that were overdue.
_overduePingCount: 0,
// Has the network shut down, making it too late to send pings?
_tooLateToSend: false,
@ -627,10 +608,6 @@ var TelemetrySendImpl = {
return this._logger;
},
get overduePingsCount() {
return this._overduePingCount;
},
get pendingPingRequests() {
return this._pendingPingRequests;
},
@ -731,11 +708,6 @@ var TelemetrySendImpl = {
const now = Policy.now();
// Check for overdue pings.
const overduePings = infos.filter((info) =>
(now.getTime() - info.lastModificationDate) > OVERDUE_PING_FILE_AGE);
this._overduePingCount = overduePings.length;
// Submit the age of the pending pings.
for (let pingInfo of infos) {
const ageInDays =
@ -783,7 +755,6 @@ var TelemetrySendImpl = {
this._shutdown = false;
this._currentPings = new Map();
this._overduePingCount = 0;
this._tooLateToSend = false;
this._isOSShutdown = false;
this._sendingEnabled = true;

View File

@ -14,7 +14,6 @@ ChromeUtils.import("resource://gre/modules/TelemetryUtils.jsm", this);
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
TelemetrySend: "resource://gre/modules/TelemetrySend.jsm",
AddonManagerPrivate: "resource://gre/modules/AddonManager.jsm",
TelemetryController: "resource://gre/modules/TelemetryController.jsm",
TelemetryStorage: "resource://gre/modules/TelemetryStorage.jsm",
@ -806,8 +805,6 @@ var Impl = {
ret.activeTicks = activeTicks;
ret.pingsOverdue = TelemetrySend.overduePingsCount;
return ret;
},

View File

@ -223,10 +223,6 @@ Integer count of the number of five-second intervals ('ticks') the user was cons
This measure might be useful to give a trend of how much a user actually interacts with the browser when compared to overall session duration. It does not take into account whether or not the window has focus or is in the foreground. Just if it is receiving these interaction events.
Note that in ``main`` pings, this measure is reset on subsession splits, while in ``saved-session`` pings it covers the whole browser session.
pingsOverdue
~~~~~~~~~~~~
Integer count of pending pings that are overdue.
histograms
----------
This section contains the histograms that are valid for the current platform. ``Flag`` histograms are always created and submitted with a default value of ``false`` if a value of ``true`` is not recorded during the time period. Other histogram types (see :ref:`choosing-histogram-type`) are not created nor submitted if no data was added to them. The type and format of the reported histograms is described by the ``Histograms.json`` file. Its most recent version is available `here <https://dxr.mozilla.org/mozilla-central/source/toolkit/components/telemetry/Histograms.json>`_. The ``info.revision`` field indicates the revision of the file that describes the reported histograms.

View File

@ -16,20 +16,11 @@ ChromeUtils.import("resource://gre/modules/TelemetrySend.jsm", this);
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {OS: {File, Path, Constants}} = ChromeUtils.import("resource://gre/modules/osfile.jsm", {});
// We increment TelemetryStorage's MAX_PING_FILE_AGE and
// OVERDUE_PING_FILE_AGE by 1 minute so that our test pings exceed
// those points in time, even taking into account file system imprecision.
const ONE_MINUTE_MS = 60 * 1000;
const OVERDUE_PING_FILE_AGE = TelemetrySend.OVERDUE_PING_FILE_AGE + ONE_MINUTE_MS;
const PING_SAVE_FOLDER = "saved-telemetry-pings";
const PING_TIMEOUT_LENGTH = 5000;
const OVERDUE_PINGS = 6;
const OLD_FORMAT_PINGS = 4;
const RECENT_PINGS = 4;
const TOTAL_EXPECTED_PINGS = OVERDUE_PINGS + RECENT_PINGS + OLD_FORMAT_PINGS;
var gCreatedPings = 0;
var gSeenPings = 0;
@ -185,7 +176,7 @@ add_task(async function test_recent_pings_sent() {
/**
* Create an overdue ping in the old format and try to send it.
*/
add_task(async function test_overdue_old_format() {
add_task(async function test_old_formats() {
// A test ping in the old, standard format.
const PING_OLD_FORMAT = {
slug: "1234567abcd",
@ -230,16 +221,12 @@ add_task(async function test_overdue_old_format() {
getSavePathForPingId("no-slug-file"),
];
// Write the ping to file and make it overdue.
// Write the ping to file
await TelemetryStorage.savePing(PING_OLD_FORMAT, true);
await TelemetryStorage.savePing(PING_NO_INFO, true);
await TelemetryStorage.savePing(PING_NO_PAYLOAD, true);
await TelemetryStorage.savePingToFile(PING_NO_SLUG, PING_FILES_PATHS[3], true);
for (let f in PING_FILES_PATHS) {
await File.setDates(PING_FILES_PATHS[f], null, Date.now() - OVERDUE_PING_FILE_AGE);
}
gSeenPings = 0;
await TelemetryController.testReset();
await TelemetrySend.testWaitOnOutgoingPings();
@ -305,31 +292,6 @@ add_task(async function test_corrupted_pending_pings() {
await TelemetryStorage.testClearPendingPings();
});
/**
* Create some recent and overdue pings and verify that they get sent.
*/
add_task(async function test_overdue_pings_trigger_send() {
let pingTypes = [
{ num: RECENT_PINGS },
{ num: OVERDUE_PINGS, age: OVERDUE_PING_FILE_AGE },
];
let pings = await createSavedPings(pingTypes);
let recentPings = pings.slice(0, RECENT_PINGS);
let overduePings = pings.slice(-OVERDUE_PINGS);
await TelemetryController.testReset();
await TelemetrySend.testWaitOnOutgoingPings();
assertReceivedPings(TOTAL_EXPECTED_PINGS);
await assertNotSaved(recentPings);
await assertNotSaved(overduePings);
Assert.equal(TelemetrySend.overduePingsCount, overduePings.length,
"Should have tracked the correct amount of overdue pings");
await TelemetryStorage.testClearPendingPings();
});
/**
* Create a ping in the old format, send it, and make sure the request URL contains
* the correct version query parameter.
@ -353,12 +315,8 @@ add_task(async function test_overdue_old_format() {
},
};
const filePath =
Path.join(Constants.Path.profileDir, PING_SAVE_FOLDER, PING_OLD_FORMAT.slug);
// Write the ping to file and make it overdue.
// Write the ping to file
await TelemetryStorage.savePing(PING_OLD_FORMAT, true);
await File.setDates(filePath, null, Date.now() - OVERDUE_PING_FILE_AGE);
let receivedPings = 0;
// Register a new prefix handler to validate the URL.