Bug 1496793 - Event telemetry should trim values if length > 80 chars r=jdescottes
authorMichael Ratcliffe <mratcliffe@mozilla.com>
Mon, 08 Oct 2018 17:12:25 +0000
changeset 498601 55515c0020e19a07152c84692a12adfd4bb40fc9
parent 498600 cd094f46a5eb09e6bc26d24be244c7177b6ccd8f
child 498602 98972a72031fb348d5b4f33d5c1efc43c79e3caa
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1496793
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 1496793 - Event telemetry should trim values if length > 80 chars r=jdescottes Differential Revision: https://phabricator.services.mozilla.com/D7989
devtools/client/shared/telemetry.js
--- a/devtools/client/shared/telemetry.js
+++ b/devtools/client/shared/telemetry.js
@@ -547,27 +547,30 @@ class Telemetry {
    *          width: "1024"
    *        }
    */
   recordEvent(method, object, value = null, extra = null) {
     // Only string values are allowed so cast all values to strings.
     if (extra) {
       for (let [name, val] of Object.entries(extra)) {
         val = val + "";
-        extra[name] = val;
 
         if (val.length > 80) {
           const sig = `${method},${object},${value}`;
 
-          throw new Error(`The property "${name}" was added to a telemetry ` +
-                          `event with the signature ${sig} but it's value ` +
-                          `"${val}" is longer than the maximum allowed length ` +
-                          `of 80 characters\n` +
-                          `CALLER: ${getCaller()}`);
+          dump(`Warning: The property "${name}" was added to a telemetry ` +
+               `event with the signature ${sig} but it's value "${val}" is ` +
+               `longer than the maximum allowed length of 80 characters.\n` +
+               `The property value has been trimmed to 80 characters before ` +
+               `sending.\nCALLER: ${getCaller()}`);
+
+          val = val.substring(0, 80);
         }
+
+        extra[name] = val;
       }
     }
     Services.telemetry.recordEvent(CATEGORY, method, object, value, extra);
   }
 
   /**
    * Sends telemetry pings to indicate that a tool has been opened.
    *