Bug 1308337 - Post: Remove old background telemetry code r=nalexander draft
authorGrigory Kruglov <gkruglov@mozilla.com>
Tue, 11 Apr 2017 22:31:18 -0400
changeset 588445 d492bf600a105f8ae2ac57c9aea6a5fb1a55f4e7
parent 588444 fa707e6adbefa016ce05cbe33443cc8d38866ae9
child 588500 328779986c76216b0942523f71f714e663824a50
push id62038
push userbmo:gkruglov@mozilla.com
push dateFri, 02 Jun 2017 20:10:10 +0000
reviewersnalexander
bugs1308337
milestone55.0a1
Bug 1308337 - Post: Remove old background telemetry code r=nalexander MozReview-Commit-ID: CONHqQWzB6c
mobile/android/base/android-services.mozbuild
mobile/android/services/src/main/java/org/mozilla/gecko/background/common/telemetry/TelemetryWrapper.java
--- a/mobile/android/base/android-services.mozbuild
+++ b/mobile/android/base/android-services.mozbuild
@@ -772,17 +772,16 @@ sync_java_files = [TOPSRCDIR + '/mobile/
     'background/common/log/writers/LevelFilteringLogWriter.java',
     'background/common/log/writers/LogWriter.java',
     'background/common/log/writers/PrintLogWriter.java',
     'background/common/log/writers/SimpleTagLogWriter.java',
     'background/common/log/writers/StringLogWriter.java',
     'background/common/log/writers/TagLogWriter.java',
     'background/common/log/writers/ThreadLocalTagLogWriter.java',
     'background/common/PrefsBranch.java',
-    'background/common/telemetry/TelemetryWrapper.java',
     'background/db/CursorDumper.java',
     'background/db/Tab.java',
     'background/fxa/FxAccount20CreateDelegate.java',
     'background/fxa/FxAccount20LoginDelegate.java',
     'background/fxa/FxAccountClient.java',
     'background/fxa/FxAccountClient20.java',
     'background/fxa/FxAccountClientException.java',
     'background/fxa/FxAccountRemoteError.java',
deleted file mode 100644
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/background/common/telemetry/TelemetryWrapper.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/* 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.background.common.telemetry;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.mozilla.gecko.background.common.log.Logger;
-
-/**
- * Android Background Services are normally built into Fennec, but can also be
- * built as a stand-alone APK for rapid local development. The current Telemetry
- * implementation is coupled to Gecko, and Background Services should not
- * interact with Gecko directly. To maintain this independence, Background
- * Services lazily introspects the relevant Telemetry class from the enclosing
- * package, warning but otherwise ignoring failures during introspection or
- * invocation.
- * <p>
- * It is possible that Background Services will introspect and invoke the
- * Telemetry implementation while Gecko is not running. In this case, the Fennec
- * process itself buffers Telemetry events until such time as they can be
- * flushed to disk and uploaded. <b>There is no guarantee that all Telemetry
- * events will be uploaded!</b> Depending on the volume of data and the
- * application lifecycle, Telemetry events may be dropped.
- */
-public class TelemetryWrapper {
-  private static final String LOG_TAG = TelemetryWrapper.class.getSimpleName();
-
-  // Marking this volatile maintains thread safety cheaply.
-  private static volatile Method mAddToHistogram;
-
-  public static void addToHistogram(String key, int value) {
-    if (mAddToHistogram == null) {
-      try {
-        final Class<?> telemetry = Class.forName("org.mozilla.gecko.Telemetry");
-        mAddToHistogram = telemetry.getMethod("addToHistogram", String.class, int.class);
-      } catch (ClassNotFoundException e) {
-        Logger.warn(LOG_TAG, "org.mozilla.gecko.Telemetry class found!");
-        return;
-      } catch (NoSuchMethodException e) {
-        Logger.warn(LOG_TAG, "org.mozilla.gecko.Telemetry.addToHistogram(String, int) method not found!");
-        return;
-      }
-    }
-
-    if (mAddToHistogram != null) {
-      try {
-        mAddToHistogram.invoke(null, key, value);
-      } catch (IllegalArgumentException | InvocationTargetException | IllegalAccessException e) {
-        Logger.warn(LOG_TAG, "Got exception invoking telemetry!");
-      }
-    }
-  }
-}