tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit eab71dafcd077fe161f0759e83d8badb04665ba1
parent f61f90a964b88c38d2f2c4295fc49dd91a5200be
Author: Mark Banner <standard8@mozilla.com>
Date:   Tue, 18 Nov 2025 18:46:50 +0000

Bug 1999462 - Remove telemetry for counting success/failure/aborts of search suggestions. r=mbeier

Differential Revision: https://phabricator.services.mozilla.com/D272689

Diffstat:
Mtoolkit/components/search/SearchSuggestionController.sys.mjs | 10----------
Mtoolkit/components/search/docs/Telemetry.rst | 15+++++++--------
Mtoolkit/components/search/metrics.yaml | 54------------------------------------------------------
Dtoolkit/components/search/tests/xpcshell/test_searchSuggestionCountTelemetry.js | 168-------------------------------------------------------------------------------
Mtoolkit/components/search/tests/xpcshell/xpcshell.toml | 5-----
Mtools/@types/generated/lib.gecko.glean.d.ts | 3---
6 files changed, 7 insertions(+), 248 deletions(-)

diff --git a/toolkit/components/search/SearchSuggestionController.sys.mjs b/toolkit/components/search/SearchSuggestionController.sys.mjs @@ -455,16 +455,6 @@ export class SearchSuggestionController { ); } context.gleanTimerId = 0; - - if (context.engine.isConfigEngine) { - if (context.aborted) { - Glean.searchSuggestions.abortedRequests[context.engine.id].add(); - } else if (context.errorWasReceived) { - Glean.searchSuggestions.failedRequests[context.engine.id].add(); - } else { - Glean.searchSuggestions.successfulRequests[context.engine.id].add(); - } - } } } diff --git a/toolkit/components/search/docs/Telemetry.rst b/toolkit/components/search/docs/Telemetry.rst @@ -141,11 +141,10 @@ search.service.initializationStatus A counter for initialization successes on start up. -search.suggestions.* -~~~~~~~~~~~~~~~~~~~~ - - Labeled counters to count the number of suggestion requests sent from app- - provided search engines. There are three separate counters for the number of - successful, aborted and failed requests. Aborted requests can happen when - users type faster than the search engine responds and failed requests when - there is an HTTP or network error. +search.suggestions.latency +~~~~~~~~~~~~~~~~~~~~~~~~~~ + + A labelled timing distribution that records the latencies (ms) of search + suggestions fetches per search engine. Keys in this histogram are the search + engine identifier for configuration provided search engines and 'other' for + search engines installed via other methods. diff --git a/toolkit/components/search/metrics.yaml b/toolkit/components/search/metrics.yaml @@ -730,57 +730,3 @@ search.suggestions: - fx-search-telemetry@mozilla.com expires: never telemetry_mirror: SEARCH_SUGGESTIONS_LATENCY_MS - - successful_requests: - type: labeled_counter - description: > - Counts the number of successful search suggestion fetches per search - engine. Only records config engines using their short IDs - ('id', not 'identifier') as labels. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1957950 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1987911 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1957950 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1987911 - data_sensitivity: - - interaction - notification_emails: - - fx-search-telemetry@mozilla.com - expires: 153 - - aborted_requests: - type: labeled_counter - description: > - Counts the number of aborted search suggestion fetches per search - engine. Only records config engines using their short IDs - ('id', not 'identifier') as labels. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1957950 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1987911 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1957950 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1987911 - data_sensitivity: - - interaction - notification_emails: - - fx-search-telemetry@mozilla.com - expires: 153 - - failed_requests: - type: labeled_counter - description: > - Counts the number of failed search suggestion fetches per search - engine. Only records config engines using their short IDs - ('id', not 'identifier') as labels. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1957950 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1987911 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=1957950 - - https://bugzilla.mozilla.org/show_bug.cgi?id=1987911 - data_sensitivity: - - interaction - notification_emails: - - fx-search-telemetry@mozilla.com - expires: 153 diff --git a/toolkit/components/search/tests/xpcshell/test_searchSuggestionCountTelemetry.js b/toolkit/components/search/tests/xpcshell/test_searchSuggestionCountTelemetry.js @@ -1,168 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. -https://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Tests whether the suggestion count telemetry is correctly divided - * into {successful, aborted, failed}, and whether it is only recorded - * for config search engines. - */ - -"use strict"; - -const { SearchSuggestionController } = ChromeUtils.importESModule( - "moz-src:///toolkit/components/search/SearchSuggestionController.sys.mjs" -); - -let openSearchEngine, workingAppEngine, failingAppEngine; - -add_setup(async function () { - // Initialize Glean. - do_get_profile(); - Services.fog.initializeFOG(); - // Initialize sjs server early so we have access to gHttpURL. - let server = useHttpServer(); - server.registerContentType("sjs", "sjs"); - - consoleAllowList = consoleAllowList.concat([ - "SearchSuggestionController found an unexpected string value", - ]); - - SearchTestUtils.setRemoteSettingsConfig([ - { - identifier: "workingAppEngine", - base: { - urls: { - suggestions: { - base: `${gHttpURL}/sjs/searchSuggestions.sjs`, - searchTermParamName: "q", - }, - }, - }, - }, - { - identifier: "failingAppEngine", - base: { - urls: { - suggestions: { - base: "http://example.invalid/", - searchTermParamName: "q", - }, - }, - }, - }, - ]); - await Services.search.init(); - - let openSearchEngineData = { - baseURL: `${gHttpURL}/sjs/`, - name: "GET suggestion engine", - method: "GET", - }; - - openSearchEngine = await SearchTestUtils.installOpenSearchEngine({ - url: `${gHttpURL}/sjs/engineMaker.sjs?${JSON.stringify(openSearchEngineData)}`, - }); - workingAppEngine = Services.search.getEngineById("workingAppEngine"); - failingAppEngine = Services.search.getEngineById("failingAppEngine"); -}); - -add_task(async function test_success() { - for (let i = 0; i < 5; i++) { - let controller = new SearchSuggestionController(); - let result = await controller.fetch({ - searchString: "mo", - inPrivateBrowsing: false, - engine: workingAppEngine, - }); - Assert.equal(result.remote.length, 3); - } - - Assert.equal( - Glean.searchSuggestions.successfulRequests.workingAppEngine.testGetValue(), - 5, - "Successful HTTP request counter is correctly updated" - ); -}); - -add_task(async function test_abort() { - let controller = new SearchSuggestionController(); - - // Don't await the result to trigger the abort handler. - controller.fetch({ - searchString: "mo", - inPrivateBrowsing: false, - engine: workingAppEngine, - }); - controller.fetch({ - searchString: "mo", - inPrivateBrowsing: false, - engine: workingAppEngine, - }); - controller.fetch({ - searchString: "mo", - inPrivateBrowsing: false, - engine: workingAppEngine, - }); - controller.fetch({ - searchString: "mo", - inPrivateBrowsing: false, - engine: workingAppEngine, - }); - await controller.fetch({ - searchString: "mo", - inPrivateBrowsing: false, - engine: workingAppEngine, - }); - - Assert.equal( - Glean.searchSuggestions.successfulRequests.workingAppEngine.testGetValue(), - 6, // 1 new + 5 from the previous test. - "Successful HTTP request counter is correctly updated" - ); - Assert.equal( - Glean.searchSuggestions.abortedRequests.workingAppEngine.testGetValue(), - 4, - "Aborted HTTP request counter is correctly updated" - ); -}); - -add_task(async function test_nonConfig() { - let controller = new SearchSuggestionController(); - let result = await controller.fetch({ - searchString: "mo", - inPrivateBrowsing: false, - engine: openSearchEngine, - }); - Assert.equal(result.remote.length, 3); - - Assert.equal( - Glean.searchSuggestions.successfulRequests.openSearchEngine.testGetValue(), - null, - "No telemetry is recorded for non-config-engine" - ); -}); - -add_task(async function test_error() { - let controller = new SearchSuggestionController(); - await controller.fetch({ - searchString: "mo", - inPrivateBrowsing: false, - engine: failingAppEngine, - }); - await controller.fetch({ - searchString: "mo", - inPrivateBrowsing: false, - engine: failingAppEngine, - }); - await controller.fetch({ - searchString: "mo", - inPrivateBrowsing: false, - engine: failingAppEngine, - }); - - Assert.equal( - Glean.searchSuggestions.failedRequests.failingAppEngine.testGetValue(), - 3, - "Failed HTTP request counter is correctly updated" - ); -}); diff --git a/toolkit/components/search/tests/xpcshell/xpcshell.toml b/toolkit/components/search/tests/xpcshell/xpcshell.toml @@ -192,11 +192,6 @@ support-files = [ ["test_searchSuggest_private.js"] -["test_searchSuggestionCountTelemetry.js"] -skip-if = [ - "appname == 'thunderbird'", -] - ["test_searchTermFromResult.js"] ["test_searchUrlDomain.js"] diff --git a/tools/@types/generated/lib.gecko.glean.d.ts b/tools/@types/generated/lib.gecko.glean.d.ts @@ -6707,10 +6707,7 @@ interface GleanImpl { } searchSuggestions: { - abortedRequests: Record<string, GleanCounter>; - failedRequests: Record<string, GleanCounter>; latency: Record<string, GleanTimingDistribution>; - successfulRequests: Record<string, GleanCounter>; } legacyTelemetry: {