Bug 1233298 - Remove query params from the `FXA_HAWK_ERRORS` probe. r=markh
authorKit Cambridge <kcambridge@mozilla.com>
Thu, 14 Jan 2016 14:32:46 -0700
changeset 281055 3f2d228dc6d93c885299e8537e8bf0a6bcf9759b
parent 281054 e73782d7fc9bf33bec1d259567b9380624e7fd8e
child 281056 caa0f5e9353a9f3a039d7886930a82eec1adba2a
push id29929
push usercbook@mozilla.com
push dateFri, 22 Jan 2016 11:02:05 +0000
treeherdermozilla-central@10254da3c9da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs1233298
milestone46.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 1233298 - Remove query params from the `FXA_HAWK_ERRORS` probe. r=markh
services/fxaccounts/FxAccountsClient.jsm
services/fxaccounts/tests/xpcshell/test_client.js
--- a/services/fxaccounts/FxAccountsClient.jsm
+++ b/services/fxaccounts/FxAccountsClient.jsm
@@ -515,18 +515,20 @@ this.FxAccountsClient.prototype = {
           CommonUtils.namedTimer(
             this._clearBackoff,
             error.retryAfter * 1000,
             this,
             "fxaBackoffTimer"
            );
         }
         if (isInvalidTokenError(error)) {
+          // Use the endpoint path as the key, ignoring query params and
+          // fragments.
           Services.telemetry.getKeyedHistogramById(
-            "FXA_HAWK_ERRORS").add(path);
+            "FXA_HAWK_ERRORS").add(path.replace(/[?#].*/, ''));
         }
         deferred.reject(error);
       }
     );
 
     return deferred.promise;
   },
 };
--- a/services/fxaccounts/tests/xpcshell/test_client.js
+++ b/services/fxaccounts/tests/xpcshell/test_client.js
@@ -813,17 +813,19 @@ add_task(function* test_client_metrics()
           errno: 111,
         });
       },
     }
   );
 
   let client = new FxAccountsClient(server.baseURI);
 
-  yield rejects(client.signOut(FAKE_SESSION_TOKEN), function(err) {
+  yield rejects(client.signOut(FAKE_SESSION_TOKEN, {
+    service: "sync",
+  }), function(err) {
     return err.errno == 111;
   });
 
   let histogram = Services.telemetry.getKeyedHistogramById("FXA_HAWK_ERRORS");
   let snapshot = histogram.snapshot("/session/destroy");
   do_check_eq(snapshot.sum, 1, "Should report Hawk authentication errors");
   histogram.clear();