Bug 1404535: Add telemetry that times nr_ice_gather. r+drno r?rweiss
MozReview-Commit-ID: I4nH8sZNX5g
--- a/media/mtransport/nricectx.cpp
+++ b/media/mtransport/nricectx.cpp
@@ -959,28 +959,37 @@ void NrIceCtx::SetCtxFlags(bool default_
}
nsresult NrIceCtx::StartGathering(bool default_route_only, bool proxy_only) {
ASSERT_ON_THREAD(sts_target_);
SetGatheringState(ICE_CTX_GATHER_STARTED);
SetCtxFlags(default_route_only, proxy_only);
+ TimeStamp start = TimeStamp::Now();
// This might start gathering for the first time, or again after
// renegotiation, or might do nothing at all if gathering has already
// finished.
int r = nr_ice_gather(ctx_, &NrIceCtx::gather_cb, this);
+
if (!r) {
SetGatheringState(ICE_CTX_GATHER_COMPLETE);
+ Telemetry::AccumulateTimeDelta(
+ Telemetry::WEBRTC_ICE_NR_ICE_GATHER_TIME_IMMEDIATE_SUCCESS, start);
} else if (r != R_WOULDBLOCK) {
MOZ_MTLOG(ML_ERROR, "Couldn't gather ICE candidates for '"
<< name_ << "', error=" << r);
SetConnectionState(ICE_CTX_FAILED);
+ Telemetry::AccumulateTimeDelta(
+ Telemetry::WEBRTC_ICE_NR_ICE_GATHER_TIME_IMMEDIATE_FAILURE, start);
return NS_ERROR_FAILURE;
+ } else {
+ Telemetry::AccumulateTimeDelta(
+ Telemetry::WEBRTC_ICE_NR_ICE_GATHER_TIME, start);
}
return NS_OK;
}
RefPtr<NrIceMediaStream> NrIceCtx::FindStream(
nr_ice_media_stream *stream) {
for (auto& stream_ : streams_) {
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -8771,16 +8771,46 @@
"alert_emails": ["webrtc-ice-telemetry-alerts@mozilla.com"],
"bug_numbers": [1342523],
"expires_in_version": "60",
"kind": "exponential",
"high": 10000,
"n_buckets": 20,
"description": "The length of time (in milliseconds) it took for the answerer to complete ICE, given that it failed. Does not count cases where StartChecks() was never called."
},
+ "WEBRTC_ICE_NR_ICE_GATHER_TIME": {
+ "record_in_processes": ["content"],
+ "alert_emails": ["webrtc-ice-telemetry-alerts@mozilla.com", "bcampen@mozilla.com"],
+ "bug_numbers": [1319268],
+ "expires_in_version": "60",
+ "kind": "exponential",
+ "high": 10000,
+ "n_buckets": 20,
+ "description": "The length of time (in milliseconds) it took to call nr_ice_gather, given that gathering did not succeed/fail immediately during the call."
+ },
+ "WEBRTC_ICE_NR_ICE_GATHER_TIME_IMMEDIATE_FAILURE": {
+ "record_in_processes": ["content"],
+ "alert_emails": ["webrtc-ice-telemetry-alerts@mozilla.com", "bcampen@mozilla.com"],
+ "bug_numbers": [1319268],
+ "expires_in_version": "60",
+ "kind": "exponential",
+ "high": 10000,
+ "n_buckets": 20,
+ "description": "The length of time (in milliseconds) it took to call nr_ice_gather, given that gathering failed immediately during the call."
+ },
+ "WEBRTC_ICE_NR_ICE_GATHER_TIME_IMMEDIATE_SUCCESS": {
+ "record_in_processes": ["content"],
+ "alert_emails": ["webrtc-ice-telemetry-alerts@mozilla.com", "bcampen@mozilla.com"],
+ "bug_numbers": [1319268],
+ "expires_in_version": "60",
+ "kind": "exponential",
+ "high": 10000,
+ "n_buckets": 20,
+ "description": "The length of time (in milliseconds) it took to call nr_ice_gather, given that gathering succeeded immediately during the call."
+ },
"WEBRTC_ICE_SUCCESS_TIME": {
"record_in_processes": ["main", "content"],
"alert_emails": ["webrtc-ice-telemetry-alerts@mozilla.com"],
"bug_numbers": [1319268],
"expires_in_version": "58",
"kind": "exponential",
"high": 10000,
"n_buckets": 20,