mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1791000 - Implement a custom ping in FOG to emulate a possible nodc implementation r=chutten
Differential Revision: https://phabricator.services.mozilla.com/D158963
This commit is contained in:
parent
02964ec3ae
commit
be272fdeb5
@ -39,6 +39,7 @@ browser.engagement:
|
||||
send_in_pings:
|
||||
- baseline
|
||||
- metrics
|
||||
- new-metric-capture-emulation
|
||||
no_lint:
|
||||
- BASELINE_PING
|
||||
|
||||
@ -67,5 +68,6 @@ browser.engagement:
|
||||
send_in_pings:
|
||||
- baseline
|
||||
- metrics
|
||||
- new-metric-capture-emulation
|
||||
no_lint:
|
||||
- BASELINE_PING
|
||||
|
@ -92,6 +92,7 @@ wr:
|
||||
send_in_pings:
|
||||
- metrics
|
||||
- pseudo-main
|
||||
- new-metric-capture-emulation
|
||||
renderer_time_no_sc:
|
||||
type: timing_distribution
|
||||
description: >
|
||||
|
@ -34,6 +34,8 @@ impl UserActivityObserver {
|
||||
// First and foremost, even if we can't get the ObserverService,
|
||||
// init always means client activity.
|
||||
glean::handle_client_active();
|
||||
// send emulation ping at startup
|
||||
glean::submit_ping_by_name("new-metric-capture-emulation", Some("active"));
|
||||
|
||||
// SAFETY: Everything here is self-contained.
|
||||
//
|
||||
@ -96,6 +98,7 @@ impl UserActivityObserver {
|
||||
inactivity.as_secs()
|
||||
);
|
||||
glean::handle_client_active();
|
||||
glean::submit_ping_by_name("new-metric-capture-emulation", Some("active"));
|
||||
}
|
||||
let mut edge = self.last_edge.write().expect("Edge lock poisoned.");
|
||||
*edge = Instant::now();
|
||||
@ -120,6 +123,7 @@ impl UserActivityObserver {
|
||||
activity.as_secs()
|
||||
);
|
||||
glean::handle_client_inactive();
|
||||
glean::submit_ping_by_name("new-metric-capture-emulation", Some("inactive"));
|
||||
}
|
||||
let mut edge = self.last_edge.write().expect("Edge lock poisoned.");
|
||||
*edge = Instant::now();
|
||||
|
@ -33,3 +33,25 @@ pseudo-main:
|
||||
notification_emails:
|
||||
- chutten@mozilla.com
|
||||
- glean-team@mozilla.com
|
||||
new-metric-capture-emulation:
|
||||
description: |
|
||||
Experimental ping to emulate the capture of new measures
|
||||
that would usually be collected in the metrics ping,
|
||||
to see if it would speed up measure completeness.
|
||||
Sends only EXISTING measures.
|
||||
reasons:
|
||||
active: |
|
||||
Submitted when application is marked active,
|
||||
when started, or when a user interacts with
|
||||
Firefox after a 20min period of inactivity
|
||||
inactive: |
|
||||
Submitted when the user stops interacting with
|
||||
Firefox after 20min of activity.
|
||||
include_client_id: true
|
||||
notification_emails:
|
||||
- pmcmanis@mozilla.com
|
||||
- glean-team@mozilla.com
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1791000
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1791000#c2
|
||||
|
@ -29,3 +29,4 @@ FOG_BACKGROUND_UPDATE_PING = FOGDocTypePingFilter("background-update")
|
||||
FOG_BASELINE_PING = FOGDocTypePingFilter("baseline")
|
||||
FOG_DELETION_REQUEST_PING = FOGDocTypePingFilter("deletion-request")
|
||||
FOG_ONE_PING_ONLY_PING = FOGDocTypePingFilter("one-ping-only")
|
||||
FOG_NODC_PING = FOGDocTypePingFilter("new-metric-capture-emulation")
|
||||
|
@ -0,0 +1,54 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from telemetry_harness.fog_ping_filters import FOG_NODC_PING
|
||||
from telemetry_harness.fog_testcase import FOGTestCase
|
||||
|
||||
|
||||
class TestNewMetricCaptureEmulation(FOGTestCase):
|
||||
"""Test for the New Metric Capture Emulation Ping (aka NODC)"""
|
||||
|
||||
@staticmethod
|
||||
def user_active(active, marionette):
|
||||
script = (
|
||||
"Services.obs.notifyObservers(null, 'user-interaction-{}active')".format(
|
||||
"" if active else "in"
|
||||
)
|
||||
)
|
||||
with marionette.using_context(marionette.CONTEXT_CHROME):
|
||||
marionette.execute_script(script)
|
||||
|
||||
def test_user_activity(self):
|
||||
# tests send on active, inactive and restart
|
||||
with self.marionette.using_context(self.marionette.CONTEXT_CHROME):
|
||||
zero_prefs_script = """\
|
||||
Services.prefs.setIntPref("telemetry.fog.test.inactivity_limit", 0);
|
||||
Services.prefs.setIntPref("telemetry.fog.test.activity_limit", 0);
|
||||
"""
|
||||
self.marionette.execute_script(zero_prefs_script)
|
||||
|
||||
active_ping = self.wait_for_ping(
|
||||
lambda: self.user_active(True, self.marionette),
|
||||
FOG_NODC_PING,
|
||||
ping_server=self.fog_ping_server,
|
||||
)
|
||||
|
||||
inactive_ping = self.wait_for_ping(
|
||||
lambda: self.user_active(False, self.marionette),
|
||||
FOG_NODC_PING,
|
||||
ping_server=self.fog_ping_server,
|
||||
)
|
||||
|
||||
self.assertEqual("active", active_ping["payload"]["ping_info"]["reason"])
|
||||
self.assertEqual("inactive", inactive_ping["payload"]["ping_info"]["reason"])
|
||||
|
||||
# Restarting the browser sends the experiment ping with
|
||||
# reason "active". One should be sent with this reason on initialization
|
||||
# of FOG, the same way it would for baseline. This has to go last.
|
||||
|
||||
fog_init_ping = self.wait_for_ping(
|
||||
self.restart_browser, FOG_NODC_PING, ping_server=self.fog_ping_server
|
||||
)
|
||||
self.assertEqual("active", fog_init_ping["payload"]["ping_info"]["reason"])
|
||||
return
|
Loading…
Reference in New Issue
Block a user