Issue #21 - Remove Telemetry from Push and devtools.

pull/28/head
Moonchild 10 months ago committed by roytam1
parent 44388b01a3
commit 69ebaa5450
  1. 3
      devtools/client/debugger/content/actions/sources.js
  2. 5
      devtools/client/debugger/new/bundle.js
  3. 15
      devtools/client/framework/test/browser_toolbox_hosts_telemetry.js
  4. 8
      dom/push/Push.js
  5. 2
      dom/push/PushRecord.jsm
  6. 35
      dom/push/PushService.jsm
  7. 2
      dom/push/PushServiceHttp2.jsm
  8. 2
      dom/push/PushServiceWebSocket.jsm

@ -180,13 +180,10 @@ function loadSourceText(source) {
[PROMISE]: Task.spawn(function* () {
let transportType = gClient.localTransport ? "_LOCAL" : "_REMOTE";
let histogramId = "DEVTOOLS_DEBUGGER_DISPLAY_SOURCE" + transportType + "_MS";
let histogram = Services.telemetry.getHistogramById(histogramId);
let startTime = Date.now();
const response = yield sourceClient.source();
histogram.add(Date.now() - startTime);
// Automatically pretty print if enabled and the test is
// detected to be "minified"
if (Prefs.autoPrettyPrint &&

@ -11474,7 +11474,6 @@ var Debugger =
if (telemetry) {
var transportType = this._transport.onOutputStreamReady === undefined ? "LOCAL_" : "REMOTE_";
var histogramId = "DEVTOOLS_DEBUGGER_RDP_" + transportType + telemetry + "_MS";
histogram = Services.telemetry.getHistogramById(histogramId);
startTime = +new Date();
}
var outgoingPacket = {
@ -11513,10 +11512,6 @@ var Debugger =
if (thisCallback) {
thisCallback(aResponse);
}
if (histogram) {
histogram.add(+new Date() - startTime);
}
}, "DebuggerClient.requester request callback"));
}, "DebuggerClient.requester");
};

@ -8,14 +8,7 @@ const {SIDE, BOTTOM, WINDOW} = Toolbox.HostType;
const URL = "data:text/html;charset=utf8,browser_toolbox_hosts_telemetry.js";
function getHostHistogram() {
return Services.telemetry.getHistogramById("DEVTOOLS_TOOLBOX_HOST");
}
add_task(function* () {
// Reset it to make counting easier
getHostHistogram().clear();
info("Create a test tab and open the toolbox");
let tab = yield addTab(URL);
let target = TargetFactory.forTab(tab);
@ -27,9 +20,6 @@ add_task(function* () {
toolbox = target = null;
gBrowser.removeCurrentTab();
// Cleanup
getHostHistogram().clear();
});
function* changeToolboxHost(toolbox) {
@ -43,8 +33,5 @@ function* changeToolboxHost(toolbox) {
}
function checkResults() {
let counts = getHostHistogram().snapshot().counts;
is(counts[0], 3, "Toolbox HostType bottom has 3 successful entries");
is(counts[1], 2, "Toolbox HostType side has 2 successful entries");
is(counts[2], 2, "Toolbox HostType window has 2 successful entries");
// STUB
}

@ -92,8 +92,6 @@ Push.prototype = {
subscribe: function(options) {
console.debug("subscribe()", this._scope);
let histogram = Services.telemetry.getHistogramById("PUSH_API_USED");
histogram.add(true);
return this.askPermission().then(() =>
this.createPromise((resolve, reject) => {
let callback = new PushSubscriptionCallback(this, resolve, reject);
@ -180,20 +178,14 @@ Push.prototype = {
principal: this._principal,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionRequest]),
allow: function() {
let histogram = Services.telemetry.getHistogramById("PUSH_API_PERMISSION_GRANTED");
histogram.add();
allowCallback();
},
cancel: function() {
let histogram = Services.telemetry.getHistogramById("PUSH_API_PERMISSION_DENIED");
histogram.add();
cancelCallback();
},
window: this._window,
};
let histogram = Services.telemetry.getHistogramById("PUSH_API_PERMISSION_REQUESTED");
histogram.add(1);
// Using askPermission from nsIDOMWindowUtils that takes care of the
// remoting if needed.
let windowUtils = this._window.QueryInterface(Ci.nsIInterfaceRequestor)

@ -84,7 +84,6 @@ PushRecord.prototype = {
Math.round(8 * Math.pow(daysElapsed, -0.8)),
prefs.get("maxQuotaPerSubscription")
);
Services.telemetry.getHistogramById("PUSH_API_QUOTA_RESET_TO").add(this.quota);
}
},
@ -125,7 +124,6 @@ PushRecord.prototype = {
// We check for ctime > 0 to skip older records that did not have ctime.
if (this.isExpired() && this.ctime > 0) {
let duration = Date.now() - this.ctime;
Services.telemetry.getHistogramById("PUSH_API_QUOTA_EXPIRATION_TIME").add(duration / 1000);
}
},

@ -1,4 +1,3 @@
/* jshint moz: true, esnext: true */
/* 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/. */
@ -51,16 +50,6 @@ const PUSH_SERVICE_CONNECTION_DISABLE = 3;
const PUSH_SERVICE_ACTIVE_OFFLINE = 4;
const PUSH_SERVICE_RUNNING = 5;
// Telemetry failure to send push notification to Service Worker reasons.
// Key not found in local database.
const kDROP_NOTIFICATION_REASON_KEY_NOT_FOUND = 0;
// User cleared history.
const kDROP_NOTIFICATION_REASON_NO_HISTORY = 1;
// Version of message received not newer than previous one.
const kDROP_NOTIFICATION_REASON_NO_VERSION_INCREMENT = 2;
// Subscription has expired.
const kDROP_NOTIFICATION_REASON_EXPIRED = 3;
/**
* State is change only in couple of functions:
* init - change state to PUSH_SERVICE_INIT if state was PUSH_SERVICE_UNINIT
@ -655,7 +644,6 @@ this.PushService = {
return;
}
Services.telemetry.getHistogramById("PUSH_API_NOTIFY_REGISTRATION_LOST").add();
gPushNotifier.notifySubscriptionChange(record.scope, record.principal);
},
@ -729,12 +717,6 @@ this.PushService = {
});
},
_recordDidNotNotify: function(reason) {
Services.telemetry.
getHistogramById("PUSH_API_NOTIFICATION_RECEIVED_BUT_DID_NOT_NOTIFY").
add(reason);
},
/**
* Dispatches an incoming message to a service worker, recalculating the
* quota for the associated push registration. If the quota is exceeded,
@ -757,7 +739,6 @@ this.PushService = {
*/
receivedPushMessage(keyID, messageID, headers, data, updateFunc) {
console.debug("receivedPushMessage()");
Services.telemetry.getHistogramById("PUSH_API_NOTIFICATION_RECEIVED").add();
return this._updateRecordAfterPush(keyID, updateFunc).then(record => {
if (record.quotaApplies()) {
@ -790,14 +771,12 @@ this.PushService = {
_updateRecordAfterPush(keyID, updateFunc) {
return this.getByKeyID(keyID).then(record => {
if (!record) {
this._recordDidNotNotify(kDROP_NOTIFICATION_REASON_KEY_NOT_FOUND);
throw new Error("No record for key ID " + keyID);
}
return record.getLastVisit().then(lastVisit => {
// As a special case, don't notify the service worker if the user
// cleared their history.
if (!isFinite(lastVisit)) {
this._recordDidNotNotify(kDROP_NOTIFICATION_REASON_NO_HISTORY);
throw new Error("Ignoring message sent to unvisited origin");
}
return lastVisit;
@ -807,7 +786,6 @@ this.PushService = {
return this._db.update(keyID, record => {
let newRecord = updateFunc(record);
if (!newRecord) {
this._recordDidNotNotify(kDROP_NOTIFICATION_REASON_NO_VERSION_INCREMENT);
return null;
}
// Because `unregister` is advisory only, we can still receive messages
@ -871,7 +849,6 @@ this.PushService = {
return record;
}).then(record => {
if (record.isExpired()) {
this._recordDidNotNotify(kDROP_NOTIFICATION_REASON_EXPIRED);
// Drop the registration in the background. If the user returns to the
// site, the service worker will be notified on the next `idle-daily`
// event.
@ -945,11 +922,6 @@ this.PushService = {
let payload = ArrayBuffer.isView(message) ?
new Uint8Array(message.buffer) : message;
if (aPushRecord.quotaApplies()) {
// Don't record telemetry for chrome push messages.
Services.telemetry.getHistogramById("PUSH_API_NOTIFY").add();
}
if (payload) {
gPushNotifier.notifyPushWithData(aPushRecord.scope,
aPushRecord.principal,
@ -998,7 +970,6 @@ this.PushService = {
_registerWithServer: function(aPageRecord) {
console.debug("registerWithServer()", aPageRecord);
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_ATTEMPT").add();
return this._sendRequest("register", aPageRecord)
.then(record => this._onRegisterSuccess(record),
err => this._onRegisterError(err))
@ -1014,12 +985,9 @@ this.PushService = {
},
_sendUnregister(aRecord, aReason) {
Services.telemetry.getHistogramById("PUSH_API_UNSUBSCRIBE_ATTEMPT").add();
return this._sendRequest("unregister", aRecord, aReason).then(function(v) {
Services.telemetry.getHistogramById("PUSH_API_UNSUBSCRIBE_SUCCEEDED").add();
return v;
}).catch(function(e) {
Services.telemetry.getHistogramById("PUSH_API_UNSUBSCRIBE_FAILED").add();
return Promise.reject(e);
});
},
@ -1033,11 +1001,9 @@ this.PushService = {
return this._db.put(aRecord)
.then(record => {
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_SUCCEEDED").add();
return record;
})
.catch(error => {
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_FAILED").add()
// Unable to save. Destroy the subscription in the background.
this._backgroundUnregister(aRecord,
Ci.nsIPushErrorReporter.UNSUBSCRIBE_MANUAL);
@ -1051,7 +1017,6 @@ this.PushService = {
*/
_onRegisterError: function(reply) {
console.debug("_onRegisterError()");
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_FAILED").add()
if (!reply.error) {
console.warn("onRegisterError: Called without valid error message!",
reply);

@ -1,4 +1,3 @@
/* jshint moz: true, esnext: true */
/* 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/. */
@ -332,7 +331,6 @@ SubscriptionListener.prototype = {
ctime: Date.now(),
});
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_HTTP2_TIME").add(Date.now() - this._ctime);
this._resolve(reply);
},

@ -1,4 +1,3 @@
/* jshint moz: true, esnext: true */
/* 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/. */
@ -638,7 +637,6 @@ this.PushServiceWebSocket = {
appServerKey: tmp.record.appServerKey,
ctime: Date.now(),
});
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_WS_TIME").add(Date.now() - tmp.ctime);
tmp.resolve(record);
} else {
console.error("handleRegisterReply: Unexpected server response", reply);

Loading…
Cancel
Save