Bug 1308337 - Part 5: Instrument FetchInfoCollectionsStage r=nalexander
authorGrigory Kruglov <gkruglov@mozilla.com>
Wed, 31 May 2017 17:38:30 -0400
changeset 412581 04eedff08896bd610fac62f18b4a27b5a09dd96a
parent 412580 99d1101ae492edd972dcad4a4831be71c780b3c0
child 412582 6e63f290b631cc9883059f3896fa88386c95b246
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1308337
milestone55.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 1308337 - Part 5: Instrument FetchInfoCollectionsStage r=nalexander MozReview-Commit-ID: 64jTO81tDpK
mobile/android/services/src/main/java/org/mozilla/gecko/sync/stage/FetchInfoCollectionsStage.java
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/stage/FetchInfoCollectionsStage.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/stage/FetchInfoCollectionsStage.java
@@ -1,44 +1,61 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.sync.stage;
 
+import android.os.SystemClock;
+
 import java.net.URISyntaxException;
 
 import org.mozilla.gecko.sync.ExtendedJSONObject;
+import org.mozilla.gecko.sync.HTTPFailureException;
 import org.mozilla.gecko.sync.InfoCollections;
 import org.mozilla.gecko.sync.delegates.JSONRecordFetchDelegate;
 import org.mozilla.gecko.sync.net.SyncStorageResponse;
+import org.mozilla.gecko.sync.telemetry.TelemetryCollector;
 
 public class FetchInfoCollectionsStage extends AbstractNonRepositorySyncStage {
   public class StageInfoCollectionsDelegate implements JSONRecordFetchDelegate {
 
     @Override
     public void handleSuccess(ExtendedJSONObject global) {
       session.config.infoCollections = new InfoCollections(global);
+      telemetryStageCollector.finished = SystemClock.elapsedRealtime();
       session.advance();
     }
 
     @Override
     public void handleFailure(SyncStorageResponse response) {
+      telemetryStageCollector.finished = SystemClock.elapsedRealtime();
+      telemetryStageCollector.error = new TelemetryCollector.StageErrorBuilder()
+              .setLastException(new HTTPFailureException(response))
+              .build();
       session.handleHTTPError(response, "Failure fetching info/collections.");
     }
 
     @Override
     public void handleError(Exception e) {
+      telemetryStageCollector.finished = SystemClock.elapsedRealtime();
+      telemetryStageCollector.error = new TelemetryCollector.StageErrorBuilder()
+              .setLastException(e)
+              .build();
       session.abort(e, "Failure fetching info/collections.");
     }
 
   }
 
   @Override
   public void execute() throws NoSuchStageException {
     try {
       session.fetchInfoCollections(new StageInfoCollectionsDelegate());
     } catch (URISyntaxException e) {
+      telemetryStageCollector.finished = SystemClock.elapsedRealtime();
+      telemetryStageCollector.error = new TelemetryCollector.StageErrorBuilder()
+              .setLastException(e)
+              .build();
       session.abort(e, "Invalid URI.");
     }
   }
 
 }