зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1919090: Flatten ICE foundations info. r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D222345
This commit is contained in:
Родитель
60c3354a9b
Коммит
43cb627c68
|
@ -338,7 +338,8 @@ export class UserCharacteristicsPageService {
|
|||
"jsErrors",
|
||||
"pointerType",
|
||||
"anyPointerType",
|
||||
"iceFoundations",
|
||||
"iceSd",
|
||||
"iceOrder",
|
||||
"motionDecimals",
|
||||
"orientationDecimals",
|
||||
"orientationabsDecimals",
|
||||
|
|
|
@ -1017,12 +1017,11 @@ async function populateICEFoundations() {
|
|||
|
||||
// With no other peers, we wouldn't get prflx candidates.
|
||||
// Relay type of candidates require a turn server.
|
||||
// So, we'll only get host and srflx candidates.
|
||||
// srflx candidates require a stun server.
|
||||
// So, we'll only get host candidates.
|
||||
const result = {
|
||||
hostLatencies: [],
|
||||
hostFoundations: [],
|
||||
srflxLatencies: [],
|
||||
srflxFoundations: [],
|
||||
latencies: [],
|
||||
foundations: [],
|
||||
};
|
||||
|
||||
let lastTime;
|
||||
|
@ -1033,14 +1032,12 @@ async function populateICEFoundations() {
|
|||
return latency;
|
||||
}
|
||||
|
||||
const pc = new RTCPeerConnection({
|
||||
iceServers: [{ urls: ["stun:stun.l.google.com:19302"] }],
|
||||
});
|
||||
const pc = new RTCPeerConnection();
|
||||
pc.onicecandidate = e => {
|
||||
const latency = calculateLatency();
|
||||
if (e.candidate && e.candidate.candidate !== "") {
|
||||
result[e.candidate.type + "Latencies"].push(latency);
|
||||
result[e.candidate.type + "Foundations"].push(e.candidate.foundation);
|
||||
result.latencies.push(latency);
|
||||
result.foundations.push(e.candidate.foundation);
|
||||
}
|
||||
};
|
||||
pc.onicegatheringstatechange = () => {
|
||||
|
@ -1063,51 +1060,33 @@ async function populateICEFoundations() {
|
|||
|
||||
// Run get candidates multiple times to see if foundation order changes
|
||||
// and calculate standard deviation of latencies
|
||||
const allLatencies = {
|
||||
srflx: [],
|
||||
host: [],
|
||||
};
|
||||
const allFoundations = {
|
||||
srflx: {},
|
||||
host: {},
|
||||
};
|
||||
const latencies = [];
|
||||
const foundations = {};
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const result = await getFoundationsAndLatencies();
|
||||
const hostFoundations = result.hostFoundations.join("");
|
||||
const srflxFoundations = result.srflxFoundations.join("");
|
||||
|
||||
allLatencies.host.push(result.hostLatencies);
|
||||
allLatencies.srflx.push(result.srflxLatencies);
|
||||
latencies.push(result.latencies);
|
||||
|
||||
const hostFoundations = result.foundations.join("");
|
||||
if (hostFoundations) {
|
||||
allFoundations.host[hostFoundations] =
|
||||
(allFoundations.host[hostFoundations] ?? 0) + 1;
|
||||
}
|
||||
if (srflxFoundations) {
|
||||
allFoundations.srflx[srflxFoundations] =
|
||||
(allFoundations.srflx[srflxFoundations] ?? 0) + 1;
|
||||
foundations[hostFoundations] = (foundations[hostFoundations] ?? 0) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
const sdLatencies = {
|
||||
host: [],
|
||||
srflx: [],
|
||||
};
|
||||
for (let i = 0; i < (allLatencies.host?.[0]?.length ?? 0); i++) {
|
||||
sdLatencies.host.push(standardDeviation(allLatencies.host.map(a => a[i])));
|
||||
}
|
||||
for (let i = 0; i < (allLatencies.srflx?.[0]?.length ?? 0); i++) {
|
||||
sdLatencies.srflx.push(
|
||||
standardDeviation(allLatencies.srflx.map(a => a[i]))
|
||||
);
|
||||
const sdLatencies = [];
|
||||
for (let i = 0; i < (latencies?.[0]?.length ?? 0); i++) {
|
||||
sdLatencies.push(standardDeviation(latencies.map(a => a[i])));
|
||||
}
|
||||
|
||||
const sd =
|
||||
sdLatencies.length > 1
|
||||
? (sdLatencies.reduce((acc, val) => acc + val, 0) / sdLatencies.length) *
|
||||
1000
|
||||
: 0;
|
||||
|
||||
return {
|
||||
iceFoundations: JSON.stringify({
|
||||
uniqueHostOrder: Object.keys(allFoundations.host).length,
|
||||
uniqueSrflxOrder: Object.keys(allFoundations.srflx).length,
|
||||
sdLatencies,
|
||||
}),
|
||||
iceSd: sd,
|
||||
iceOrder: Object.keys(foundations).length,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -2587,25 +2587,41 @@ characteristics:
|
|||
data_sensitivity:
|
||||
- technical
|
||||
|
||||
ice_foundations:
|
||||
type: text
|
||||
ice_order:
|
||||
type: quantity
|
||||
unit: int
|
||||
description: >
|
||||
Unique ICE foundations occurance count and the
|
||||
standard deviation of latencies
|
||||
Unique ICE foundations occurrence count
|
||||
lifetime: application
|
||||
send_in_pings:
|
||||
- user-characteristics
|
||||
notification_emails:
|
||||
- tom@mozilla.com
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1902003
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1919090
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1902003#c2
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1919090#c4
|
||||
expires: never
|
||||
data_sensitivity:
|
||||
# Text metrics are _required_ to be web_activity or highly_sensitive, so even though this
|
||||
# is more like 'technical' (per the Data Review), I'm marking highly sensitive.
|
||||
- highly_sensitive
|
||||
- technical
|
||||
|
||||
ice_sd:
|
||||
type: quantity
|
||||
unit: int
|
||||
description: >
|
||||
ICE foundation discovery latency standard deviation sum multiplied by 1000
|
||||
lifetime: application
|
||||
send_in_pings:
|
||||
- user-characteristics
|
||||
notification_emails:
|
||||
- tom@mozilla.com
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1919090
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1919090#c4
|
||||
expires: never
|
||||
data_sensitivity:
|
||||
- technical
|
||||
|
||||
pointer_height:
|
||||
type: quantity
|
||||
|
|
Загрузка…
Ссылка в новой задаче