зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1463171 - Instrument inspection of "edit and resend" in the Network Panel with event telemetry r=miker
Differential Revision: https://phabricator.services.mozilla.com/D3238 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d8e1e3ce51
Коммит
5c943145d9
|
@ -35,7 +35,7 @@ const CUSTOM_SEND = L10N.getStr("netmonitor.custom.send");
|
|||
/*
|
||||
* Custom request panel component
|
||||
* A network request editor which simply provide edit and resend interface
|
||||
* for netowrk development.
|
||||
* for network development.
|
||||
*/
|
||||
class CustomRequestPanel extends Component {
|
||||
static get propTypes() {
|
||||
|
|
|
@ -11,6 +11,7 @@ const {
|
|||
ENABLE_REQUEST_FILTER_TYPE_ONLY,
|
||||
SET_REQUEST_FILTER_TEXT,
|
||||
SELECT_DETAILS_PANEL_TAB,
|
||||
SEND_CUSTOM_REQUEST,
|
||||
} = require("../constants");
|
||||
|
||||
/**
|
||||
|
@ -50,7 +51,6 @@ function eventTelemetryMiddleware(connector, telemetry) {
|
|||
// Record telemetry event when side panel is selected.
|
||||
if (action.type == SELECT_DETAILS_PANEL_TAB) {
|
||||
sidePanelChange({
|
||||
action,
|
||||
state,
|
||||
oldState,
|
||||
telemetry,
|
||||
|
@ -58,6 +58,14 @@ function eventTelemetryMiddleware(connector, telemetry) {
|
|||
});
|
||||
}
|
||||
|
||||
// Record telemetry event when a request is resent.
|
||||
if (action.type == SEND_CUSTOM_REQUEST) {
|
||||
sendCustomRequest({
|
||||
telemetry,
|
||||
sessionId,
|
||||
});
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
}
|
||||
|
@ -106,7 +114,7 @@ function filterChange({action, state, oldState, telemetry, sessionId}) {
|
|||
* It's responsible for recording "sidepanel_tool_changed"
|
||||
* telemetry event.
|
||||
*/
|
||||
function sidePanelChange({action, state, oldState, telemetry, sessionId}) {
|
||||
function sidePanelChange({state, oldState, telemetry, sessionId}) {
|
||||
telemetry.recordEvent("devtools.main", "sidepanel_changed", "netmonitor", null, {
|
||||
"oldpanel": oldState.ui.detailsPanelSelectedTab,
|
||||
"newpanel": state.ui.detailsPanelSelectedTab,
|
||||
|
@ -114,4 +122,14 @@ function sidePanelChange({action, state, oldState, telemetry, sessionId}) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This helper function is executed when a request is resent.
|
||||
* It's responsible for recording "edit_resend" telemetry event.
|
||||
*/
|
||||
function sendCustomRequest({telemetry, sessionId}) {
|
||||
telemetry.recordEvent("devtools.main", "edit_resend", "netmonitor", null, {
|
||||
"session_id": sessionId,
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = eventTelemetryMiddleware;
|
||||
|
|
|
@ -185,6 +185,7 @@ skip-if = true # Bug 1373558
|
|||
[browser_net_status-bar.js]
|
||||
[browser_net_status-codes.js]
|
||||
[browser_net_streaming-response.js]
|
||||
[browser_net_telemetry_edit_resend.js]
|
||||
[browser_net_telemetry_filters_changed.js]
|
||||
[browser_net_telemetry_sidepanel_changed.js]
|
||||
[browser_net_throttle.js]
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const OPTOUT = Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTOUT;
|
||||
|
||||
/**
|
||||
* Test the edit_resend telemetry event.
|
||||
*/
|
||||
add_task(async function() {
|
||||
const { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
info("Starting test... ");
|
||||
|
||||
const { document, store, windowRequire } = monitor.panelWin;
|
||||
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
// Remove all telemetry events (you can check about:telemetry).
|
||||
Services.telemetry.clearEvents();
|
||||
|
||||
// Ensure no events have been logged
|
||||
const snapshot = Services.telemetry.snapshotEvents(OPTOUT, true);
|
||||
ok(!snapshot.parent, "No events have been logged for the main process");
|
||||
|
||||
// Reload to have one request in the list.
|
||||
const waitForEvents = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.loadURI(SIMPLE_URL);
|
||||
await waitForEvents;
|
||||
|
||||
// Open context menu and execute "Edit & Resend".
|
||||
const firstRequest = document.querySelectorAll(".request-list-item")[0];
|
||||
const waitForHeaders = waitUntil(() => document.querySelector(".headers-overview"));
|
||||
EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest);
|
||||
await waitForHeaders;
|
||||
await waitForRequestData(store, ["requestHeaders", "responseHeaders"]);
|
||||
EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest);
|
||||
|
||||
// Open "New Request" form and resend.
|
||||
monitor.panelWin.parent.document.querySelector("#request-list-context-resend").click();
|
||||
await waitUntil(() => document.querySelector("#custom-request-send-button"));
|
||||
document.querySelector("#custom-request-send-button").click();
|
||||
|
||||
await waitForNetworkEvents(monitor, 1);
|
||||
|
||||
// Verify existence of the telemetry event.
|
||||
checkTelemetryEvent({}, {
|
||||
method: "edit_resend"
|
||||
});
|
||||
|
||||
return teardown(monitor);
|
||||
});
|
|
@ -539,6 +539,16 @@ devtools.main:
|
|||
oldpanel: The panel the user is switching from
|
||||
newpanel: The panel the user is switching to
|
||||
session_id: The start time of the session in milliseconds since epoch (Unix Timestamp) e.g. 1396381378123.
|
||||
edit_resend:
|
||||
objects: ["netmonitor"]
|
||||
bug_numbers: [1463171]
|
||||
notification_emails: ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"]
|
||||
record_in_processes: ["main"]
|
||||
description: User has executed edit / resend in the netmonitor.
|
||||
release_channel_collection: opt-out
|
||||
expiry_version: never
|
||||
extra_keys:
|
||||
session_id: The toolbox session start time e.g. 13963.
|
||||
execute_js:
|
||||
objects: ["webconsole"]
|
||||
bug_numbers: [1463083]
|
||||
|
|
Загрузка…
Ссылка в новой задаче