Bug 1518609 - Add telemetry to legacy maxRetransmitTime DataChannel param r=jib,janerik

Adds telemetry to the DataChannel init param maxRetransmitTime.

Differential Revision: https://phabricator.services.mozilla.com/D15999

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nico Grunbaum 2019-04-11 01:42:51 +00:00
Родитель a6180a6479
Коммит 6db783d06e
2 изменённых файлов: 113 добавлений и 7 удалений

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

@ -36,8 +36,6 @@ const PC_TRANSCEIVER_CID = Components.ID("{09475754-103a-41f5-a2d0-e1f27eb0b537}
const PC_COREQUEST_CID = Components.ID("{74b2122d-65a8-4824-aa9e-3d664cb75dc2}");
const PC_DTMF_SENDER_CID = Components.ID("{3610C242-654E-11E6-8EC0-6D1BE389A607}");
const TELEMETRY_PC_CONNECTED = "webrtc.peerconnection.connected";
const TELEMETRY_PC_PROMISE_GETSTATS = "webrtc.peerconnection.promise_stats_used";
function logMsg(msg, file, line, flag, winID) {
let scriptErrorClass = Cc["@mozilla.org/scripterror;1"];
let scriptError = scriptErrorClass.createInstance(Ci.nsIScriptError);
@ -313,18 +311,55 @@ setupPrototype(RTCStatsReport, {
QueryInterface: ChromeUtils.generateQI([]),
});
// This is its own class so that it does not need to be exposed to the client.
// Records PC related telemetry
class PeerConnectionTelemetry {
// Record which style(s) of invocation for getStats are used
recordGetStats() {
Services.telemetry.scalarAdd(TELEMETRY_PC_PROMISE_GETSTATS, 1);
Services.telemetry.scalarAdd("webrtc.peerconnection.promise_stats_used",
1);
this.recordGetStats = () => {};
}
// ICE connection state enters connected or completed.
recordConnected() {
Services.telemetry.scalarAdd(TELEMETRY_PC_CONNECTED, 1);
Services.telemetry.scalarAdd("webrtc.peerconnection.connected", 1);
this.recordConnected = () => {};
}
// DataChannel is created
_recordDataChannelCreated() {
Services.telemetry.scalarAdd("webrtc.peerconnection.datachannel_created",
1);
this._recordDataChannelCreated = () => {};
}
// DataChannel initialized with maxRetransmitTime
_recordMaxRetransmitTime(maxRetransmitTime) {
if (maxRetransmitTime === undefined) {
return false;
}
Services.telemetry.scalarAdd(
"webrtc.peerconnection.datachannel_max_retx_used", 1);
this._recordMaxRetransmitTime = () => true;
return true;
}
// DataChannel initialized with maxPacketLifeTime
_recordMaxPacketLifeTime(maxPacketLifeTime) {
if (maxPacketLifeTime === undefined) {
return false;
}
Services.telemetry.scalarAdd(
"webrtc.peerconnection.datachannel_max_life_used", 1);
this._recordMaxPacketLifeTime = () => true;
return true;
}
// DataChannel initialized
recordDataChannelInit(maxRetransmitTime, maxPacketLifeTime) {
const retxUsed = this._recordMaxRetransmitTime(maxRetransmitTime);
if (this._recordMaxPacketLifeTime(maxPacketLifeTime) && retxUsed) {
Services.telemetry.scalarAdd(
"webrtc.peerconnection.datachannel_max_retx_and_life_used", 1);
this.recordDataChannelInit = () => {};
}
this._recordDataChannelCreated();
}
}
// Cache for RTPSourceEntries
@ -1571,10 +1606,15 @@ class RTCPeerConnection {
createDataChannel(label, {
maxRetransmits, ordered, negotiated, id = 0xFFFF,
maxRetransmitTime, maxPacketLifeTime = maxRetransmitTime,
maxRetransmitTime, maxPacketLifeTime,
protocol,
} = {}) {
this._checkClosed();
this._pcTelemetry.recordDataChannelInit(maxRetransmitTime, maxPacketLifeTime);
if (maxPacketLifeTime === undefined) {
maxPacketLifeTime = maxRetransmitTime;
}
if (maxRetransmitTime !== undefined) {
this.logWarning("Use maxPacketLifeTime instead of deprecated maxRetransmitTime which will stop working soon in createDataChannel!");

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

@ -771,7 +771,73 @@ webrtc.peerconnection:
record_in_processes:
- 'main'
- 'content'
datachannel_created:
bug_numbers:
- 1518609
description: >
The number of RTCPeerConnection objects in which a RTCDataChannel was
created. This is recorded once for each RTCPeerConnection after the first
RTCDataChannel is created.
expires: "70"
kind: uint
notification_emails:
- ngrunbaum@mozilla.com
release_channel_collection: opt-out
record_in_processes:
- 'main'
- 'content'
datachannel_max_retx_used:
bug_numbers:
- 1518609
description: >
The number of RTCPeerConnection objects in which one or more
RTCDataChannels were created with the legacy maxRetransmitTime option
instead of the new, synonymous maxPacketLifeTime option. This is recorded
once for each RTCPeerConnection after a RTCDataChannel is created with
the maxRetransmitTime option.
expires: "70"
kind: uint
notification_emails:
- ngrunbaum@mozilla.com
release_channel_collection: opt-out
record_in_processes:
- 'main'
- 'content'
datachannel_max_life_used:
bug_numbers:
- 1518609
description: >
The number of RTCPeerConnection objects in which one or more RTCDataChannels
were created with the maxPacketLifeTime option instead of the deprecated,
synonymous maxRetransmitTime option. This is recorded once for each
RTCPeerConnection after a RTCDataChannel is created with the
maxPacketLifeTime option.
expires: "70"
kind: uint
notification_emails:
- ngrunbaum@mozilla.com
release_channel_collection: opt-out
record_in_processes:
- 'main'
- 'content'
datachannel_max_retx_and_life_used:
bug_numbers:
- 1518609
description: >
The number of RTCPeerConnection objects in which one or more RTCDataChannels
were created with both maxPacketLifeTime and the deprecated, synonymous
maxRetransmitTime option. This is recorded once for each
RTCPeerConnection after RTCDataChannels have been created with the
maxPacketLifeTime and the maxRetransmitTime options, either together
or in seperate invocations.
expires: "70"
kind: uint
notification_emails:
- ngrunbaum@mozilla.com
release_channel_collection: opt-out
record_in_processes:
- 'main'
- 'content'
# The following section contains WebRTC nICEr scalars
# For more info on ICE, see https://tools.ietf.org/html/rfc5245
# For more info on STUN, see https://tools.ietf.org/html/rfc5389