Bug 1535169 - Add telemetry counting total URIs including private browsing mode. r=mconley

Differential Revision: https://phabricator.services.mozilla.com/D96109
This commit is contained in:
Micah Tigley 2020-11-14 00:11:36 +00:00
Родитель ad48150054
Коммит 6e8947cd63
4 изменённых файлов: 65 добавлений и 8 удалений

Просмотреть файл

@ -64,6 +64,8 @@ const UNIQUE_DOMAINS_COUNT_SCALAR_NAME =
const TOTAL_URI_COUNT_SCALAR_NAME = "browser.engagement.total_uri_count";
const UNFILTERED_URI_COUNT_SCALAR_NAME =
"browser.engagement.unfiltered_uri_count";
const TOTAL_URI_COUNT_NORMAL_AND_PRIVATE_MODE_SCALAR_NAME =
"browser.engagement.total_uri_count_normal_and_private_mode";
// A list of known search origins.
const KNOWN_SEARCH_SOURCES = [
@ -339,6 +341,12 @@ let URICountListener = {
SearchTelemetry.updateTrackingStatus(browser, uriSpec);
}
// Update total URI count, including when in private mode.
Services.telemetry.scalarAdd(
TOTAL_URI_COUNT_NORMAL_AND_PRIVATE_MODE_SCALAR_NAME,
1
);
if (!shouldCountURI) {
return;
}

Просмотреть файл

@ -9,6 +9,8 @@ const WINDOW_OPEN_COUNT = "browser.engagement.window_open_event_count";
const TOTAL_URI_COUNT = "browser.engagement.total_uri_count";
const UNIQUE_DOMAINS_COUNT = "browser.engagement.unique_domains_count";
const UNFILTERED_URI_COUNT = "browser.engagement.unfiltered_uri_count";
const TOTAL_URI_COUNT_NORMAL_AND_PRIVATE_MODE =
"browser.engagement.total_uri_count_normal_and_private_mode";
const TELEMETRY_SUBSESSION_TOPIC = "internal-telemetry-after-subsession-split";
@ -88,6 +90,12 @@ let checkScalars = countsObject => {
countsObject.totalUnfilteredURIs,
"The unfiltered URI count must match the expected value."
);
TelemetryTestUtils.assertScalar(
scalars,
TOTAL_URI_COUNT_NORMAL_AND_PRIVATE_MODE,
countsObject.totalURIsNormalAndPrivateMode,
"The total URI count for both normal and private mode must match the expected value."
);
};
add_task(async function test_tabsAndWindows() {
@ -101,6 +109,7 @@ add_task(async function test_tabsAndWindows() {
let expectedMaxWins = 0;
let expectedMaxTabsPinned = 0;
let expectedTabPinned = 0;
let expectedTotalURIs = 0;
// Add a new tab and check that the count is right.
openedTabs.push(
@ -121,11 +130,12 @@ add_task(async function test_tabsAndWindows() {
tabOpenCount: expectedTabOpenCount,
maxWindows: expectedMaxWins,
windowsOpenCount: expectedWinOpenCount,
totalURIs: 0,
totalURIs: expectedTotalURIs,
domainCount: 0,
totalUnfilteredURIs: 0,
maxTabsPinned: expectedMaxTabsPinned,
tabPinnedCount: expectedTabPinned,
totalURIsNormalAndPrivateMode: expectedTotalURIs,
});
// Add two new tabs in the same window.
@ -150,11 +160,12 @@ add_task(async function test_tabsAndWindows() {
tabOpenCount: expectedTabOpenCount,
maxWindows: expectedMaxWins,
windowsOpenCount: expectedWinOpenCount,
totalURIs: 0,
totalURIs: expectedTotalURIs,
domainCount: 0,
totalUnfilteredURIs: 0,
maxTabsPinned: expectedMaxTabsPinned,
tabPinnedCount: expectedTabPinned,
totalURIsNormalAndPrivateMode: expectedTotalURIs,
});
// Add a new window and then some tabs in it. An empty new windows counts as a tab.
@ -181,11 +192,12 @@ add_task(async function test_tabsAndWindows() {
tabOpenCount: expectedTabOpenCount,
maxWindows: expectedMaxWins,
windowsOpenCount: expectedWinOpenCount,
totalURIs: 0,
totalURIs: expectedTotalURIs,
domainCount: 0,
totalUnfilteredURIs: 0,
maxTabsPinned: expectedMaxTabsPinned,
tabPinnedCount: expectedTabPinned,
totalURIsNormalAndPrivateMode: expectedTotalURIs,
});
// Remove all the extra windows and tabs.
@ -200,11 +212,12 @@ add_task(async function test_tabsAndWindows() {
tabOpenCount: expectedTabOpenCount,
maxWindows: expectedMaxWins,
windowsOpenCount: expectedWinOpenCount,
totalURIs: 0,
totalURIs: expectedTotalURIs,
domainCount: 0,
totalUnfilteredURIs: 0,
maxTabsPinned: expectedMaxTabsPinned,
tabPinnedCount: expectedTabPinned,
totalURIsNormalAndPrivateMode: expectedTotalURIs,
});
});
@ -231,16 +244,19 @@ add_task(async function test_subsessionSplit() {
// Check that the scalars have the right values. We expect 2 unfiltered URI loads
// (about:mozilla and www.example.com, but no about:blank) and 1 URI totalURIs
// (only www.example.com).
let expectedTotalURIs = 1;
checkScalars({
maxTabs: 5,
tabOpenCount: 4,
maxWindows: 2,
windowsOpenCount: 1,
totalURIs: 1,
totalURIs: expectedTotalURIs,
domainCount: 1,
totalUnfilteredURIs: 2,
maxTabsPinned: 0,
tabPinnedCount: 0,
totalURIsNormalAndPrivateMode: expectedTotalURIs,
});
// Remove a tab.
@ -254,16 +270,19 @@ add_task(async function test_subsessionSplit() {
// After a subsession split, only the MAX_CONCURRENT_* scalars must be available
// and have the correct value. No tabs, windows or URIs were opened so other scalars
// must not be reported.
expectedTotalURIs = 0;
checkScalars({
maxTabs: 4,
tabOpenCount: 0,
maxWindows: 2,
windowsOpenCount: 0,
totalURIs: 0,
totalURIs: expectedTotalURIs,
domainCount: 0,
totalUnfilteredURIs: 0,
maxTabsPinned: 0,
tabPinnedCount: 0,
totalURIsNormalAndPrivateMode: expectedTotalURIs,
});
// Remove all the extra windows and tabs.

Просмотреть файл

@ -11,6 +11,8 @@ const WINDOW_OPEN_COUNT = "browser.engagement.window_open_event_count";
const TOTAL_URI_COUNT = "browser.engagement.total_uri_count";
const UNFILTERED_URI_COUNT = "browser.engagement.unfiltered_uri_count";
const UNIQUE_DOMAINS_COUNT = "browser.engagement.unique_domains_count";
const TOTAL_URI_COUNT_NORMAL_AND_PRIVATE_MODE =
"browser.engagement.total_uri_count_normal_and_private_mode";
function promiseBrowserStateRestored() {
return new Promise(resolve => {
@ -73,6 +75,11 @@ add_task(async function test_privateMode() {
2,
"The maximum window count must match the expected value."
);
is(
scalars[TOTAL_URI_COUNT_NORMAL_AND_PRIVATE_MODE],
1,
"We should include URIs in private mode as part of the actual total URI count."
);
// Clean up.
await BrowserTestUtils.closeWindow(privateWin);

Просмотреть файл

@ -197,8 +197,31 @@ browser.engagement:
- 1529232
description: >
The count of the total non-unique http(s) URIs visited in a subsession, including
page reloads, after the session has been restored. This does not include background
page requests and URIs from embedded pages or private browsing.
page reloads, after the session has been restored. URIs on minimized or background
tabs may also be counted towards this. Private browsing is not included in this
count.
expires: never
kind: uint
notification_emails:
- rweiss@mozilla.com
- loines@mozilla.com
release_channel_collection: opt-out
products:
- 'firefox'
- 'fennec'
record_in_processes:
- 'main'
record_into_store:
- 'main'
- 'account-ecosystem'
total_uri_count_normal_and_private_mode:
bug_numbers:
- 1535169
description: >
The count of the total non-unique http(s) URIs visited in a subsession, including
page reloads, after the session has been restored. URIs on minimized or background
tabs may also be counted towards this. Private browsing is included in this count.
expires: never
kind: uint
notification_emails: