@@ -57,7 +57,6 @@ export const CATEGORIZATION_SETTINGS = {
5757 STARTING_RANK : 2 ,
5858 IDLE_TIMEOUT_SECONDS : 60 * 60 ,
5959 WAKE_TIMEOUT_MS : 60 * 60 * 1000 ,
60- PING_SUBMISSION_THRESHOLD : 10 ,
6160} ;
6261
6362ChromeUtils . defineLazyGetter ( lazy , "logConsole" , ( ) => {
@@ -86,22 +85,13 @@ XPCOMUtils.defineLazyPreferenceGetter(
8685 if ( newValue ) {
8786 SearchSERPDomainToCategoriesMap . init ( ) ;
8887 SearchSERPCategorizationEventScheduler . init ( ) ;
89- SERPCategorizationRecorder . init ( ) ;
9088 } else {
9189 SearchSERPDomainToCategoriesMap . uninit ( ) ;
9290 SearchSERPCategorizationEventScheduler . uninit ( ) ;
93- SERPCategorizationRecorder . uninit ( ) ;
9491 }
9592 }
9693) ;
9794
98- XPCOMUtils . defineLazyPreferenceGetter (
99- lazy ,
100- "activityLimit" ,
101- "telemetry.fog.test.activity_limit" ,
102- 120
103- ) ;
104-
10595export const SearchSERPTelemetryUtils = {
10696 ACTIONS : {
10797 CLICKED : "clicked" ,
@@ -2124,58 +2114,6 @@ class CategorizationEventScheduler {
21242114 * Handles reporting SERP categorization telemetry to Glean.
21252115 */
21262116class CategorizationRecorder {
2127- #init = false ;
2128-
2129- // The number of SERP categorizations that have been recorded but not yet
2130- // reported in a Glean ping.
2131- #serpCategorizationsCount = 0 ;
2132-
2133- // When the user started interacting with the SERP.
2134- #userInteractionStartTime = null ;
2135-
2136- async init ( ) {
2137- if ( this . #init) {
2138- return ;
2139- }
2140-
2141- Services . obs . addObserver ( this , "user-interaction-active" ) ;
2142- Services . obs . addObserver ( this , "user-interaction-inactive" ) ;
2143- this . #init = true ;
2144- this . submitPing ( "startup" ) ;
2145- }
2146-
2147- uninit ( ) {
2148- if ( this . #init) {
2149- Services . obs . removeObserver ( this , "user-interaction-active" ) ;
2150- Services . obs . removeObserver ( this , "user-interaction-inactive" ) ;
2151- this . #resetCategorizationRecorderData( ) ;
2152- this . #init = false ;
2153- }
2154- }
2155-
2156- observe ( subject , topic , data ) {
2157- switch ( topic ) {
2158- case "user-interaction-active" :
2159- // If the user is already active, we don't want to overwrite the start
2160- // time.
2161- if ( this . #userInteractionStartTime == null ) {
2162- this . #userInteractionStartTime = Date . now ( ) ;
2163- }
2164- break ;
2165- case "user-interaction-inactive" :
2166- let currentTime = Date . now ( ) ;
2167- let activityLimitInMs = lazy . activityLimit * 1000 ;
2168- if (
2169- this . #userInteractionStartTime &&
2170- currentTime - this . #userInteractionStartTime >= activityLimitInMs
2171- ) {
2172- this . submitPing ( "inactivity" ) ;
2173- }
2174- this . #userInteractionStartTime = null ;
2175- break ;
2176- }
2177- }
2178-
21792117 /**
21802118 * Helper function for recording the SERP categorization event.
21812119 *
@@ -2187,25 +2125,7 @@ class CategorizationRecorder {
21872125 "Reporting the following categorization result:" ,
21882126 resultToReport
21892127 ) ;
2190- Glean . serp . categorization . record ( resultToReport ) ;
2191-
2192- this . #serpCategorizationsCount++ ;
2193- if (
2194- this . #serpCategorizationsCount >=
2195- CATEGORIZATION_SETTINGS . PING_SUBMISSION_THRESHOLD
2196- ) {
2197- this . submitPing ( "threshold_reached" ) ;
2198- this . #serpCategorizationsCount = 0 ;
2199- }
2200- }
2201-
2202- submitPing ( reason ) {
2203- GleanPings . serpCategorization . submit ( reason ) ;
2204- }
2205-
2206- #resetCategorizationRecorderData( ) {
2207- this . #serpCategorizationsCount = 0 ;
2208- this . #userInteractionStartTime = null ;
2128+ // TODO: Bug 1868476 - Report result to Glean.
22092129 }
22102130}
22112131
0 commit comments