Bug 1491511: add Telemetry for SRTP cipher usage. r=mt
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Wed, 19 Sep 2018 00:08:25 +0000
changeset 437312 b2b65230f72439afb4e030f0301931c1da35d313
parent 437311 43fdb025935200d722e40c189c0284dc806993da
child 437313 8a4b3376e5c416b7cdd82e68ec7085625dee60b7
push id69612
push usernohlmeier@mozilla.com
push dateWed, 19 Sep 2018 21:38:23 +0000
treeherderautoland@b2b65230f724 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmt
bugs1491511
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1491511: add Telemetry for SRTP cipher usage. r=mt Bug 1491511: add Telemetry for SRTP cipher usage. r=mt Differential Revision: https://phabricator.services.mozilla.com/D5956
media/mtransport/transportlayerdtls.cpp
toolkit/components/telemetry/Histograms.json
--- a/media/mtransport/transportlayerdtls.cpp
+++ b/media/mtransport/transportlayerdtls.cpp
@@ -1523,17 +1523,17 @@ TransportLayerDtls::RecordHandshakeCompl
 
 void
 TransportLayerDtls::RecordCipherTelemetry() {
   uint16_t cipher;
 
   nsresult rv = GetCipherSuite(&cipher);
 
   if (NS_FAILED(rv)) {
-    MOZ_MTLOG(ML_ERROR, "Failed to get cipher suite");
+    MOZ_MTLOG(ML_ERROR, "Failed to get DTLS cipher suite");
     return;
   }
 
   uint16_t t_cipher = 0;
 
   switch (cipher) {
     /* Old DHE ciphers: candidates for removal, see bug 1227519 */
     case TLS_DHE_RSA_WITH_AES_128_CBC_SHA:
@@ -1575,11 +1575,39 @@ TransportLayerDtls::RecordCipherTelemetr
       t_cipher = 12;
       break;
     case TLS_AES_256_GCM_SHA384:
       t_cipher = 13;
       break;
   }
 
   Telemetry::Accumulate(Telemetry::WEBRTC_DTLS_CIPHER, t_cipher);
+
+  rv = GetSrtpCipher(&cipher);
+
+  if (NS_FAILED(rv)) {
+    MOZ_MTLOG(ML_ERROR, "Failed to get SRTP cipher suite");
+    return;
+  }
+
+  mozilla::Telemetry::LABELS_WEBRTC_SRTP_CIPHER label =
+    mozilla::Telemetry::LABELS_WEBRTC_SRTP_CIPHER::Unknown;
+
+  switch (cipher) {
+    case kDtlsSrtpAes128CmHmacSha1_80:
+      label = Telemetry::LABELS_WEBRTC_SRTP_CIPHER::Aes128CmHmacSha1_80;
+      break;
+    case kDtlsSrtpAes128CmHmacSha1_32:
+      label = Telemetry::LABELS_WEBRTC_SRTP_CIPHER::Aes128CmHmacSha1_32;
+      break;
+    case kDtlsSrtpAeadAes128Gcm:
+      label = Telemetry::LABELS_WEBRTC_SRTP_CIPHER::AeadAes128Gcm;
+      break;
+    case kDtlsSrtpAeadAes256Gcm:
+      label = Telemetry::LABELS_WEBRTC_SRTP_CIPHER::AeadAes256Gcm;
+      break;
+  }
+
+  Telemetry::AccumulateCategorical(label);
+
 }
 
 }  // close namespace
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -8668,16 +8668,25 @@
     "record_in_processes": ["content"],
     "alert_emails": ["webrtc-dtls-telemetry-alerts@mozilla.com", "nohlmeier@mozilla.com"],
     "bug_numbers": [1484024],
     "expires_in_version": "66",
     "kind": "enumerated",
     "n_values": 14,
     "description": "The DTLS cipher (as integer) negotiated for a RTCPeerConnection. See TransportLayerDtls::RecordCipherTelemetry for the meaning of the values"
   },
+  "WEBRTC_SRTP_CIPHER": {
+    "record_in_processes": ["content"],
+    "alert_emails": ["webrtc-dtls-telemetry-alerts@mozilla.com", "nohlmeier@mozilla.com"],
+    "bug_numbers": [1491511],
+    "expires_in_version": "67",
+    "kind": "categorical",
+    "labels": ["Unknown", "Aes128CmHmacSha1_80", "Aes128CmHmacSha1_32", "AeadAes128Gcm", "AeadAes256Gcm"],
+    "description": "The SRTP cipher (as integer) negotiated for a RTCPeerConnection. See TransportLayerDtls::RecordCipherTelemetry for the meaning of the values"
+  },
   "WEBRTC_ICE_FINAL_CONNECTION_STATE": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["webrtc-ice-telemetry-alerts@mozilla.com, nohlmeier@mozilla.com"],
     "bug_numbers": [1319268],
     "expires_in_version": "62",
     "kind": "enumerated",
     "n_values": 7,
     "description": "The ICE connection state when the PC was closed"