Bug 1647876 - Record how long users interact with Firefox Desktop r=janerik

Differential Revision: https://phabricator.services.mozilla.com/D81188
This commit is contained in:
Chris H-C 2020-07-09 15:30:11 +00:00
Родитель 9dec41defd
Коммит e8a302fd2f
3 изменённых файлов: 71 добавлений и 0 удалений

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

@ -15373,5 +15373,18 @@
"bug_numbers": [1627708],
"description": "Input device that triggered the zoom gesture (InputData::PinchGestureSource)",
"releaseChannelCollection": "opt-out"
},
"FOG_EVAL_USER_ACTIVE_S" : {
"products": ["firefox"],
"record_in_processes": ["main"],
"alert_emails": ["chutten@mozilla.com"],
"expires_in_version": "85",
"kind": "exponential",
"keyed": false,
"high": 7200,
"n_buckets": 50,
"bug_numbers": [1647876],
"description": "Seconds between `user-interaction-active` and `user-interaction-inactive`. For use in evaluating baseline engagement for Project FOG.",
"releaseChannelCollection": "opt-out"
}
}

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

@ -4985,6 +4985,40 @@ migration:
operating_systems:
- windows
fog.eval:
user_active:
bug_numbers:
- 1647876
description: >
Whether the user is presently actively interacting with Firefox.
For use in evaluating baseline engagement for Project FOG.
expires: '85'
kind: 'boolean'
notification_emails:
- 'chutten@mozilla.com'
release_channel_collection: 'opt-out'
products:
- 'firefox'
record_in_processes:
- 'main'
user_active_error:
bug_numbers:
- 1647876
description: >
How many Telemetry stopwatch errors did we have while trying to measure user activity?
These could be attempts to start a started timer or finish an unstarted timer or so forth.
See Stopwatch::Start and Stopwatch::Finish for details.
For use in evaluating baseline engagement for Project FOG.
expires: '85'
kind: 'uint'
notification_emails:
- 'chutten@mozilla.com'
release_channel_collection: 'opt-out'
products:
- 'firefox'
record_in_processes:
- 'main'
# The following section is for probes testing the Telemetry system. They will not be
# submitted in pings and are only used for testing.

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

@ -321,6 +321,10 @@ var Impl = {
// The activity state for the user. If false, don't count the next
// active tick. Otherwise, increment the active ticks as usual.
_isUserActive: true,
// The activity state for the user. Inits to false so that the initial
// activity doesn't cause a stopwatch error.
// Used to evaluate FOG user engagement.
_fogUserActive: false,
_startupIO: {},
// The previous build ID, if this is the first run with a new build.
// Null if this is the first run, or the previous build ID is unknown.
@ -1147,6 +1151,10 @@ var Impl = {
*/
_onActiveTick(aUserActive) {
const needsUpdate = aUserActive && this._isUserActive;
const userActivityChanged =
(aUserActive && !this._fogUserActive) ||
(!aUserActive && this._fogUserActive);
this._fogUserActive = aUserActive;
this._isUserActive = aUserActive;
// Don't count the first active tick after we get out of
@ -1155,6 +1163,22 @@ var Impl = {
this._sessionActiveTicks++;
Telemetry.scalarAdd("browser.engagement.active_ticks", 1);
}
if (userActivityChanged) {
// FOG User Engagement Evaluation.
Telemetry.scalarSet("fog.eval.user_active", aUserActive);
let error = false;
if (aUserActive) {
error = !TelemetryStopwatch.start("FOG_EVAL_USER_ACTIVE_S", null, {
inSeconds: true,
});
} else {
error = !TelemetryStopwatch.finish("FOG_EVAL_USER_ACTIVE_S");
}
if (error) {
Telemetry.scalarAdd("fog.eval.user_active_error", 1);
}
}
},
/**