bug 1353295 - Remove addonHistograms from Telemetry r=Dexter
authorChris H-C <chutten@mozilla.com>
Thu, 06 Apr 2017 15:31:58 -0400
changeset 353612 890a29e0bd94e8c3e8cbf9f6fcfab4c50f2377e7
parent 353611 e5e754f197cd5f1f0bc3c4179c9f1236b3b43c48
child 353613 853da67e9bc36e64db26075cc81c94f34e76a4af
push id31673
push userkwierso@gmail.com
push dateTue, 18 Apr 2017 21:23:54 +0000
treeherdermozilla-central@1a81aadc2510 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersDexter
bugs1353295, 1355882
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 1353295 - Remove addonHistograms from Telemetry r=Dexter addonHistograms isn't being used and has started getting in the way. So it goes. Leave the "Addon Histograms" section in about:telemetry for 60 days. Remove it in bug 1355882 MozReview-Commit-ID: 4lm7ONirofl
b2g/chrome/content/devtools/hud.js
toolkit/components/telemetry/Telemetry.cpp
toolkit/components/telemetry/TelemetryHistogram.cpp
toolkit/components/telemetry/TelemetryHistogram.h
toolkit/components/telemetry/TelemetrySession.jsm
toolkit/components/telemetry/docs/data/main-ping.rst
toolkit/components/telemetry/nsITelemetry.idl
toolkit/components/telemetry/tests/unit/test_TelemetryHistograms.js
toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
--- a/b2g/chrome/content/devtools/hud.js
+++ b/b2g/chrome/content/devtools/hud.js
@@ -255,69 +255,37 @@ Target.prototype = {
 
   _send(data) {
     let frame = this.frame;
 
     shell.sendEvent(frame, 'developer-hud-update', Cu.cloneInto(data, frame));
     this._logHistogram(data.metric);
   },
 
-  _getAddonHistogram(item) {
-    let appName = this._getAddonHistogramName(item, APPNAME_IDX);
-    let histName = this._getAddonHistogramName(item, HISTNAME_IDX);
-
-    return Services.telemetry.getAddonHistogram(appName, CUSTOM_HISTOGRAM_PREFIX
-      + histName);
-  },
-
-  _getAddonHistogramName(item, index) {
-    let array = item.split('_');
-    return array[index].toUpperCase();
-  },
-
   _clearTelemetryData() {
     developerHUD._histograms.forEach(function(item) {
       Services.telemetry.getKeyedHistogramById(item).clear();
     });
-
-    developerHUD._customHistograms.forEach(item => {
-      this._getAddonHistogram(item).clear();
-    });
   },
 
   _sendTelemetryData() {
     if (!developerHUD._telemetry) {
       return;
     }
     telemetryDebug('calling sendTelemetryData');
     let frame = this.frame;
     let payload = {
       keyedHistograms: {},
-      addonHistograms: {}
     };
     // Package the hud histograms.
     developerHUD._histograms.forEach(function(item) {
       payload.keyedHistograms[item] =
         Services.telemetry.getKeyedHistogramById(item).snapshot();
     });
 
-    // Package the registered hud custom histograms
-    developerHUD._customHistograms.forEach(item => {
-      let appName = this._getAddonHistogramName(item, APPNAME_IDX);
-      let histName = CUSTOM_HISTOGRAM_PREFIX +
-        this._getAddonHistogramName(item, HISTNAME_IDX);
-      let addonHist = Services.telemetry.getAddonHistogram(appName, histName).snapshot();
-      if (!(appName in payload.addonHistograms)) {
-        payload.addonHistograms[appName] = {};
-      }
-      // Do not include histograms with sum of 0.
-      if (addonHist.sum > 0) {
-        payload.addonHistograms[appName][histName] = addonHist;
-      }
-    });
     shell.sendEvent(frame, 'advanced-telemetry-update', Cu.cloneInto(payload, frame));
   },
 
   _logHistogram(metric) {
     //method left as no-op as histograms are not in use anymore.
   }
 };
 
--- a/toolkit/components/telemetry/Telemetry.cpp
+++ b/toolkit/components/telemetry/Telemetry.cpp
@@ -1311,41 +1311,16 @@ TelemetryImpl::AddSQLInfo(JSContext *cx,
   }
 
   return JS_DefineProperty(cx, rootObj,
                            mainThread ? "mainThread" : "otherThreads",
                            statsObj, JSPROP_ENUMERATE);
 }
 
 NS_IMETHODIMP
-TelemetryImpl::RegisterAddonHistogram(const nsACString &id,
-                                      const nsACString &name,
-                                      uint32_t histogramType,
-                                      uint32_t min, uint32_t max,
-                                      uint32_t bucketCount,
-                                      uint8_t optArgCount)
-{
-  return TelemetryHistogram::RegisterAddonHistogram
-            (id, name, histogramType, min, max, bucketCount, optArgCount);
-}
-
-NS_IMETHODIMP
-TelemetryImpl::GetAddonHistogram(const nsACString &id, const nsACString &name,
-                                 JSContext *cx, JS::MutableHandle<JS::Value> ret)
-{
-  return TelemetryHistogram::GetAddonHistogram(id, name, cx, ret);
-}
-
-NS_IMETHODIMP
-TelemetryImpl::UnregisterAddonHistograms(const nsACString &id)
-{
-  return TelemetryHistogram::UnregisterAddonHistograms(id);
-}
-
-NS_IMETHODIMP
 TelemetryImpl::SetHistogramRecordingEnabled(const nsACString &id, bool aEnabled)
 {
   return TelemetryHistogram::SetHistogramRecordingEnabled(id, aEnabled);
 }
 
 NS_IMETHODIMP
 TelemetryImpl::GetHistogramSnapshots(JSContext *cx, JS::MutableHandle<JS::Value> ret)
 {
@@ -1361,22 +1336,16 @@ TelemetryImpl::SnapshotSubsessionHistogr
   return TelemetryHistogram::CreateHistogramSnapshots(cx, ret, true,
                                                       clearSubsession);
 #else
   return NS_OK;
 #endif
 }
 
 NS_IMETHODIMP
-TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, JS::MutableHandle<JS::Value> ret)
-{
-  return TelemetryHistogram::GetAddonHistogramSnapshots(cx, ret);
-}
-
-NS_IMETHODIMP
 TelemetryImpl::GetKeyedHistogramSnapshots(JSContext *cx, JS::MutableHandle<JS::Value> ret)
 {
   return TelemetryHistogram::GetKeyedHistogramSnapshots(cx, ret);
 }
 
 bool
 TelemetryImpl::GetSQLStats(JSContext *cx, JS::MutableHandle<JS::Value> ret, bool includePrivateSql)
 {
@@ -2953,17 +2922,16 @@ TelemetryImpl::RunPingSender(const nsACS
 #endif
 }
 
 size_t
 TelemetryImpl::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
 {
   size_t n = aMallocSizeOf(this);
 
-  // Ignore the hashtables in mAddonMap; they are not significant.
   n += TelemetryHistogram::GetMapShallowSizesOfExcludingThis(aMallocSizeOf);
   n += TelemetryScalar::GetMapShallowSizesOfExcludingThis(aMallocSizeOf);
   n += mWebrtcTelemetry.SizeOfExcludingThis(aMallocSizeOf);
   { // Scope for mHashMutex lock
     MutexAutoLock lock(mHashMutex);
     n += mPrivateSQL.SizeOfExcludingThis(aMallocSizeOf);
     n += mSanitizedSQL.SizeOfExcludingThis(aMallocSizeOf);
   }
--- a/toolkit/components/telemetry/TelemetryHistogram.cpp
+++ b/toolkit/components/telemetry/TelemetryHistogram.cpp
@@ -52,18 +52,18 @@ namespace TelemetryIPCAccumulator = mozi
 //   |gTelemetryHistogramMutex|, so they do not have to be
 //   thread-safe.  However, those internal_* functions that are
 //   reachable from internal_WrapAndReturnHistogram and
 //   internal_WrapAndReturnKeyedHistogram can sometimes be called
 //   without |gTelemetryHistogramMutex|, and so might be racey.
 //
 // * Functions named TelemetryHistogram::*.  This is the external interface.
 //   Entries and exits to these functions are serialised using
-//   |gTelemetryHistogramMutex|, except for GetAddonHistogramSnapshots,
-//   GetKeyedHistogramSnapshots and CreateHistogramSnapshots.
+//   |gTelemetryHistogramMutex|, except for GetKeyedHistogramSnapshots and
+//   CreateHistogramSnapshots.
 //
 // Avoiding races and deadlocks:
 //
 // All functions in the external interface (TelemetryHistogram::*) are
 // serialised using the mutex |gTelemetryHistogramMutex|.  This means
 // that the external interface is thread-safe, and many of the
 // internal_* functions can ignore thread safety.  But it also brings
 // a danger of deadlock if any function in the external interface can
@@ -133,43 +133,24 @@ struct HistogramInfo {
   uint32_t label_count;
   bool keyed;
 
   const char *id() const;
   const char *expiration() const;
   nsresult label_id(const char* label, uint32_t* labelId) const;
 };
 
-struct AddonHistogramInfo {
-  uint32_t min;
-  uint32_t max;
-  uint32_t bucketCount;
-  uint32_t histogramType;
-  Histogram *h;
-};
-
 enum reflectStatus {
   REFLECT_OK,
   REFLECT_CORRUPT,
   REFLECT_FAILURE
 };
 
 typedef StatisticsRecorder::Histograms::iterator HistogramIterator;
 
-typedef nsBaseHashtableET<nsCStringHashKey, AddonHistogramInfo>
-          AddonHistogramEntryType;
-
-typedef AutoHashtable<AddonHistogramEntryType>
-          AddonHistogramMapType;
-
-typedef nsBaseHashtableET<nsCStringHashKey, AddonHistogramMapType *>
-          AddonEntryType;
-
-typedef AutoHashtable<AddonEntryType> AddonMapType;
-
 } // namespace
 
 
 ////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////
 //
 // PRIVATE STATE, SHARED BY ALL THREADS
 
@@ -185,18 +166,16 @@ HistogramMapType gHistogramMap(mozilla::
 
 KeyedHistogramMapType gKeyedHistograms;
 
 bool gCorruptHistograms[mozilla::Telemetry::HistogramCount];
 
 // This is for gHistograms, gHistogramStringTable
 #include "TelemetryHistogramData.inc"
 
-AddonMapType gAddonMap;
-
 // The singleton StatisticsRecorder object for this process.
 base::StatisticsRecorder* gStatisticsRecorder = nullptr;
 
 } // namespace
 
 
 ////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////
@@ -1140,118 +1119,16 @@ internal_GetKeyedHistogramById(const nsA
 }
 
 } // namespace
 
 
 ////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////
 //
-// PRIVATE: functions related to addon histograms
-
-namespace {
-
-// Compute the name to pass into Histogram for the addon histogram
-// 'name' from the addon 'id'.  We can't use 'name' directly because it
-// might conflict with other histograms in other addons or even with our
-// own.
-void
-internal_AddonHistogramName(const nsACString &id, const nsACString &name,
-                            nsACString &ret)
-{
-  ret.Append(id);
-  ret.Append(':');
-  ret.Append(name);
-}
-
-bool
-internal_CreateHistogramForAddon(const nsACString &name,
-                                 AddonHistogramInfo &info)
-{
-  Histogram *h;
-  nsresult rv = internal_HistogramGet(PromiseFlatCString(name).get(), "never",
-                                      info.histogramType, info.min, info.max,
-                                      info.bucketCount, true, &h);
-  if (NS_FAILED(rv)) {
-    return false;
-  }
-  // Don't let this histogram be reported via the normal means
-  // (e.g. Telemetry.registeredHistograms); we'll make it available in
-  // other ways.
-  h->ClearFlags(Histogram::kUmaTargetedHistogramFlag);
-  info.h = h;
-  return true;
-}
-
-bool
-internal_AddonHistogramReflector(AddonHistogramEntryType *entry,
-                                 JSContext *cx, JS::Handle<JSObject*> obj)
-{
-  AddonHistogramInfo &info = entry->mData;
-
-  // Never even accessed the histogram.
-  if (!info.h) {
-    // Have to force creation of HISTOGRAM_FLAG histograms.
-    if (info.histogramType != nsITelemetry::HISTOGRAM_FLAG)
-      return true;
-
-    if (!internal_CreateHistogramForAddon(entry->GetKey(), info)) {
-      return false;
-    }
-  }
-
-  if (internal_IsEmpty(info.h)) {
-    return true;
-  }
-
-  JS::Rooted<JSObject*> snapshot(cx, JS_NewPlainObject(cx));
-  if (!snapshot) {
-    // Just consider this to be skippable.
-    return true;
-  }
-  switch (internal_ReflectHistogramSnapshot(cx, snapshot, info.h)) {
-  case REFLECT_FAILURE:
-  case REFLECT_CORRUPT:
-    return false;
-  case REFLECT_OK:
-    const nsACString &histogramName = entry->GetKey();
-    if (!JS_DefineProperty(cx, obj, PromiseFlatCString(histogramName).get(),
-                           snapshot, JSPROP_ENUMERATE)) {
-      return false;
-    }
-    break;
-  }
-  return true;
-}
-
-bool
-internal_AddonReflector(AddonEntryType *entry, JSContext *cx,
-                        JS::Handle<JSObject*> obj)
-{
-  const nsACString &addonId = entry->GetKey();
-  JS::Rooted<JSObject*> subobj(cx, JS_NewPlainObject(cx));
-  if (!subobj) {
-    return false;
-  }
-
-  AddonHistogramMapType *map = entry->mData;
-  if (!(map->ReflectIntoJS(internal_AddonHistogramReflector, cx, subobj)
-        && JS_DefineProperty(cx, obj, PromiseFlatCString(addonId).get(),
-                             subobj, JSPROP_ENUMERATE))) {
-    return false;
-  }
-  return true;
-}
-
-} // namespace
-
-
-////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////
-//
 // PRIVATE: thread-unsafe helpers for the external interface
 
 // This is a StaticMutex rather than a plain Mutex (1) so that
 // it gets initialised in a thread-safe manner the first time
 // it is used, and (2) because it is never de-initialised, and
 // a normal Mutex would show up as a leak in BloatView.  StaticMutex
 // also has the "OffTheBooks" property, so it won't show as a leak
 // in BloatView.
@@ -2009,17 +1886,16 @@ void TelemetryHistogram::InitializeGloba
 
 void TelemetryHistogram::DeInitializeGlobalState()
 {
   StaticMutexAutoLock locker(gTelemetryHistogramMutex);
   gCanRecordBase = false;
   gCanRecordExtended = false;
   gHistogramMap.Clear();
   gKeyedHistograms.Clear();
-  gAddonMap.Clear();
   gInitDone = false;
 }
 
 #ifdef DEBUG
 bool TelemetryHistogram::GlobalStateHasBeenInitialized() {
   StaticMutexAutoLock locker(gTelemetryHistogramMutex);
   return gInitDone;
 }
@@ -2414,153 +2290,22 @@ TelemetryHistogram::GetKeyedHistogramSna
       return NS_ERROR_FAILURE;
     }
   }
 
   ret.setObject(*obj);
   return NS_OK;
 }
 
-nsresult
-TelemetryHistogram::RegisterAddonHistogram(const nsACString &id,
-                                           const nsACString &name,
-                                           uint32_t histogramType,
-                                           uint32_t min, uint32_t max,
-                                           uint32_t bucketCount,
-                                           uint8_t optArgCount)
-{
-  StaticMutexAutoLock locker(gTelemetryHistogramMutex);
-  if (histogramType == nsITelemetry::HISTOGRAM_EXPONENTIAL ||
-      histogramType == nsITelemetry::HISTOGRAM_LINEAR) {
-    if (optArgCount != 3) {
-      return NS_ERROR_INVALID_ARG;
-    }
-
-    // Sanity checks for histogram parameters.
-    if (min >= max)
-      return NS_ERROR_ILLEGAL_VALUE;
-
-    if (bucketCount <= 2)
-      return NS_ERROR_ILLEGAL_VALUE;
-
-    if (min < 1)
-      return NS_ERROR_ILLEGAL_VALUE;
-  } else {
-    min = 1;
-    max = 2;
-    bucketCount = 3;
-  }
-
-  AddonEntryType *addonEntry = gAddonMap.GetEntry(id);
-  if (!addonEntry) {
-    addonEntry = gAddonMap.PutEntry(id);
-    if (MOZ_UNLIKELY(!addonEntry)) {
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
-    addonEntry->mData = new AddonHistogramMapType();
-  }
-
-  AddonHistogramMapType *histogramMap = addonEntry->mData;
-  AddonHistogramEntryType *histogramEntry = histogramMap->GetEntry(name);
-  // Can't re-register the same histogram.
-  if (histogramEntry) {
-    return NS_ERROR_FAILURE;
-  }
-
-  histogramEntry = histogramMap->PutEntry(name);
-  if (MOZ_UNLIKELY(!histogramEntry)) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
-  AddonHistogramInfo &info = histogramEntry->mData;
-  info.min = min;
-  info.max = max;
-  info.bucketCount = bucketCount;
-  info.histogramType = histogramType;
-
-  return NS_OK;
-}
-
-nsresult
-TelemetryHistogram::GetAddonHistogram(const nsACString &id,
-                                      const nsACString &name,
-                                      JSContext *cx,
-                                      JS::MutableHandle<JS::Value> ret)
-{
-  AddonHistogramInfo* info = nullptr;
-  {
-    StaticMutexAutoLock locker(gTelemetryHistogramMutex);
-    AddonEntryType *addonEntry = gAddonMap.GetEntry(id);
-    // The given id has not been registered.
-    if (!addonEntry) {
-      return NS_ERROR_INVALID_ARG;
-    }
-
-    AddonHistogramMapType *histogramMap = addonEntry->mData;
-    AddonHistogramEntryType *histogramEntry = histogramMap->GetEntry(name);
-    // The given histogram name has not been registered.
-    if (!histogramEntry) {
-      return NS_ERROR_INVALID_ARG;
-    }
-
-    info = &histogramEntry->mData;
-    if (!info->h) {
-      nsAutoCString actualName;
-      internal_AddonHistogramName(id, name, actualName);
-      if (!internal_CreateHistogramForAddon(actualName, *info)) {
-        return NS_ERROR_FAILURE;
-      }
-    }
-  }
-
-  // Runs without protection from |gTelemetryHistogramMutex|
-  return internal_WrapAndReturnHistogram(info->h, cx, ret);
-}
-
-nsresult
-TelemetryHistogram::UnregisterAddonHistograms(const nsACString &id)
-{
-  StaticMutexAutoLock locker(gTelemetryHistogramMutex);
-  AddonEntryType *addonEntry = gAddonMap.GetEntry(id);
-  if (addonEntry) {
-    // Histogram's destructor is private, so this is the best we can do.
-    // The histograms the addon created *will* stick around, but they
-    // will be deleted if and when the addon registers histograms with
-    // the same names.
-    delete addonEntry->mData;
-    gAddonMap.RemoveEntry(addonEntry);
-  }
-
-  return NS_OK;
-}
-
-nsresult
-TelemetryHistogram::GetAddonHistogramSnapshots(JSContext *cx,
-                                               JS::MutableHandle<JS::Value> ret)
-{
-  // Runs without protection from |gTelemetryHistogramMutex|
-  JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
-  if (!obj) {
-    return NS_ERROR_FAILURE;
-  }
-
-  if (!gAddonMap.ReflectIntoJS(internal_AddonReflector, cx, obj)) {
-    return NS_ERROR_FAILURE;
-  }
-  ret.setObject(*obj);
-  return NS_OK;
-}
-
 size_t
 TelemetryHistogram::GetMapShallowSizesOfExcludingThis(mozilla::MallocSizeOf
                                                       aMallocSizeOf)
 {
   StaticMutexAutoLock locker(gTelemetryHistogramMutex);
-  return gAddonMap.ShallowSizeOfExcludingThis(aMallocSizeOf) +
-         gHistogramMap.ShallowSizeOfExcludingThis(aMallocSizeOf);
+  return gHistogramMap.ShallowSizeOfExcludingThis(aMallocSizeOf);
 }
 
 size_t
 TelemetryHistogram::GetHistogramSizesofIncludingThis(mozilla::MallocSizeOf
                                                      aMallocSizeOf)
 {
   StaticMutexAutoLock locker(gTelemetryHistogramMutex);
   StatisticsRecorder::Histograms hs;
--- a/toolkit/components/telemetry/TelemetryHistogram.h
+++ b/toolkit/components/telemetry/TelemetryHistogram.h
@@ -71,31 +71,16 @@ RegisteredHistograms(uint32_t aDataset, 
 
 nsresult
 RegisteredKeyedHistograms(uint32_t aDataset, uint32_t *aCount,
                           char*** aHistograms);
 
 nsresult
 GetKeyedHistogramSnapshots(JSContext *cx, JS::MutableHandle<JS::Value> ret);
 
-nsresult
-RegisterAddonHistogram(const nsACString &id, const nsACString &name,
-                       uint32_t histogramType, uint32_t min, uint32_t max,
-                       uint32_t bucketCount, uint8_t optArgCount);
-
-nsresult
-GetAddonHistogram(const nsACString &id, const nsACString &name,
-                  JSContext *cx, JS::MutableHandle<JS::Value> ret);
-
-nsresult
-UnregisterAddonHistograms(const nsACString &id);
-
-nsresult
-GetAddonHistogramSnapshots(JSContext *cx, JS::MutableHandle<JS::Value> ret);
-
 size_t
 GetMapShallowSizesOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf);
 
 size_t
 GetHistogramSizesofIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
 
 } // namespace TelemetryHistogram
 
--- a/toolkit/components/telemetry/TelemetrySession.jsm
+++ b/toolkit/components/telemetry/TelemetrySession.jsm
@@ -907,33 +907,16 @@ var Impl = {
           ret[suffix][name] = this.packHistogram(hls[name + suffix]);
         }
       }
     }
 
     return ret;
   },
 
-  getAddonHistograms: function getAddonHistograms() {
-    let ahs = Telemetry.addonHistogramSnapshots;
-    let ret = {};
-
-    for (let addonName in ahs) {
-      let addonHistograms = ahs[addonName];
-      let packedHistograms = {};
-      for (let name in addonHistograms) {
-        packedHistograms[name] = this.packHistogram(addonHistograms[name]);
-      }
-      if (Object.keys(packedHistograms).length != 0)
-        ret[addonName] = packedHistograms;
-    }
-
-    return ret;
-  },
-
   getKeyedHistograms(subsession, clearSubsession) {
     let registered =
       Telemetry.registeredKeyedHistograms(this.getDatasetType(), []);
     if (this._testing == false) {
       // Omit telemetry test histograms outside of tests.
       registered = registered.filter(id => !id.startsWith("TELEMETRY_TEST_"));
     }
     let ret = {};
@@ -1330,22 +1313,16 @@ var Impl = {
     payloadObj.info = info;
 
     // Add extended set measurements for chrome process.
     if (Telemetry.canRecordExtended) {
       payloadObj.slowSQL = protect(() => Telemetry.slowSQL);
       payloadObj.fileIOReports = protect(() => Telemetry.fileIOReports);
       payloadObj.lateWrites = protect(() => Telemetry.lateWrites);
 
-      // Add the addon histograms if they are present
-      let addonHistograms = protect(() => this.getAddonHistograms());
-      if (addonHistograms && Object.keys(addonHistograms).length > 0) {
-        payloadObj.addonHistograms = addonHistograms;
-      }
-
       payloadObj.addonDetails = protect(() => AddonManagerPrivate.getTelemetryDetails());
 
       let clearUIsession = !(reason == REASON_GATHER_PAYLOAD || reason == REASON_GATHER_SUBSESSION_PAYLOAD);
 
       if (AppConstants.platform == "android") {
         payloadObj.UIMeasurements = protect(() => UITelemetry.getUIMeasurements(clearUIsession));
       }
 
--- a/toolkit/components/telemetry/docs/data/main-ping.rst
+++ b/toolkit/components/telemetry/docs/data/main-ping.rst
@@ -66,17 +66,16 @@ Structure:
       threadHangStats: [...],
       capturedStacks: {...},
       log: [...],
       webrtc: {...},
       gc: {...},
       fileIOReports: {...},
       lateWrites: {...},
       addonDetails: {...},
-      addonHistograms: {...},
       UIMeasurements: [...],  // Android only
       slowSQL: {...},
       slowSQLstartup: {...},
     }
 
 info
 ----
 
@@ -145,17 +144,17 @@ This section contains the :doc:`../colle
 events
 ~~~~~~
 This section contains the :ref:`eventtelemetry` that are recorded for the current subsession. Events are not always recorded, recording has to be enabled first for the Firefox session.
 
 The recorded events are defined in the `Events.yaml <https://dxr.mozilla.org/mozilla-central/source/toolkit/components/telemetry/Events.yaml>`_. The ``info.revision`` field indicates the revision of the file that describes the reported events.
 
 childPayloads
 -------------
-The Telemetry payloads sent by child processes, recorded on child process shutdown (event ``content-child-shutdown`` observed). They are reduced session payloads, only available with e10s. Among some other things, they don't contain histograms, keyed histograms, addon details, addon histograms, or UI Telemetry.
+The Telemetry payloads sent by child processes, recorded on child process shutdown (event ``content-child-shutdown`` observed). They are reduced session payloads, only available with e10s. Among some other things, they don't contain histograms, keyed histograms, addon details, or UI Telemetry.
 
 Note: Child payloads are not collected and cleared with subsession splits, they are currently only meaningful when analysed from ``saved-session`` or ``main`` pings with ``reason`` set to ``shutdown``.
 
 Note: Before Firefox 51 and bug 1218576, content process histograms and keyedHistograms were in the individual child payloads instead of being aggregated into ``processes.content``.
 
 simpleMeasurements
 ------------------
 This section contains a list of simple measurements, or counters. In addition to the ones highlighted below, Telemetry timestamps (see `here <https://dxr.mozilla.org/mozilla-central/search?q=%22TelemetryTimestamps.add%22&redirect=false&case=true>`_ and `here <https://dxr.mozilla.org/mozilla-central/search?q=%22recordTimestamp%22&redirect=false&case=true>`_) can be reported.
@@ -630,20 +629,16 @@ Structure:
           "creator": "Mozilla & Android Open Source Project",
           "startup_MS": 30
         },
         ...
       },
       ...
     }
 
-addonHistograms
----------------
-This section contains the histogram registered by the addons (`see here <https://dxr.mozilla.org/mozilla-central/rev/584870f1cbc5d060a57e147ce249f736956e2b62/toolkit/components/telemetry/nsITelemetry.idl#303>`_). This section is not present if no addon histogram is available.
-
 UITelemetry
 -----------
 See the ``UITelemetry data format`` documentation.
 
 slowSQL
 -------
 This section contains the informations about the slow SQL queries for both the main and other threads. The execution of an SQL statement is considered slow if it takes 50ms or more on the main thread or 100ms or more on other threads. Slow SQL statements will be automatically trimmed to 1000 characters. This limit doesn't include the ellipsis and database name, that are appended at the end of the stored statement.
 
--- a/toolkit/components/telemetry/nsITelemetry.idl
+++ b/toolkit/components/telemetry/nsITelemetry.idl
@@ -310,79 +310,27 @@ interface nsITelemetry : nsISupports
 
   /**
    * A flag indicating whether Telemetry can submit official results (for base or extended
    * data). This is true on official, non-debug builds with built in support for Mozilla
    * Telemetry reporting.
    */
   readonly attribute boolean isOfficialTelemetry;
 
-  /** Addon telemetry hooks */
-
-  /**
-   * Register a histogram for an addon.  Throws an error if the
-   * histogram name has been registered previously.
-   *
-   * @param addon_id - Unique ID of the addon
-   * @param name - Unique histogram name
-   * @param histogram_type - HISTOGRAM_EXPONENTIAL, HISTOGRAM_LINEAR,
-   *        HISTOGRAM_BOOLEAN or HISTOGRAM_COUNT
-   * @param min - Minimal bucket size
-   * @param max - Maximum bucket size
-   * @param bucket_count - number of buckets in the histogram
-   */
-  [optional_argc]
-  void registerAddonHistogram(in ACString addon_id, in ACString name,
-                              in unsigned long histogram_type,
-                              [optional] in uint32_t min,
-                              [optional] in uint32_t max,
-                              [optional] in uint32_t bucket_count);
-
-  /**
-   * Return a histogram previously registered via
-   * registerAddonHistogram.  Throws an error if the id/name combo has
-   * not been registered via registerAddonHistogram.
-   *
-   * @param addon_id - Unique ID of the addon
-   * @param name - Registered histogram name
-   *
-   */
-  [implicit_jscontext]
-  jsval getAddonHistogram(in ACString addon_id, in ACString name);
-
-  /**
-   * Delete all histograms associated with the given addon id.
-   *
-   * @param addon_id - Unique ID of the addon
-   */
-  void unregisterAddonHistograms(in ACString addon_id);
-
   /**
    * Enable/disable recording for this histogram at runtime.
    * Recording is enabled by default, unless listed at kRecordingInitiallyDisabledIDs[].
    * Name must be a valid Histogram identifier, otherwise an assertion will be triggered.
    *
    * @param id - unique identifier from histograms.json
    * @param enabled - whether or not to enable recording from now on.
    */
   void setHistogramRecordingEnabled(in ACString id, in boolean enabled);
 
   /**
-   * An object containing a snapshot from all of the currently
-   * registered addon histograms.
-   * { addon-id1 : data1, ... }
-   *
-   * where data is an object whose properties are the names of the
-   * addon's histograms and whose corresponding values are as in
-   * histogramSnapshots.
-   */
-  [implicit_jscontext]
-  readonly attribute jsval addonHistogramSnapshots;
-
-  /**
    * Read data from the previous run. After the callback is called, the last
    * shutdown time is available in lastShutdownDuration and any late
    * writes in lateWrites.
    */
   void asyncFetchTelemetryData(in nsIFetchTelemetryDataCallback aCallback);
 
   /**
    * Get statistics of file IO reports, null, if not recorded.
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryHistograms.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryHistograms.js
@@ -425,104 +425,16 @@ add_task(function* test_histogramRecordi
   h = Telemetry.getHistogramById("TELEMETRY_TEST_RELEASE_OPTOUT");
   h.clear();
   orig = h.snapshot();
   h.add(1);
   Assert.equal(orig.sum + 1, h.snapshot().sum,
                "Histogram value should have incremented by 1 due to recording.");
 });
 
-add_task(function* test_addons() {
-  var addon_id = "testing-addon";
-  var fake_addon_id = "fake-addon";
-  var name1 = "testing-histogram1";
-  var register = Telemetry.registerAddonHistogram;
-  expect_success(() =>
-                 register(addon_id, name1, Telemetry.HISTOGRAM_LINEAR, 1, 5, 6));
-  // Can't register the same histogram multiple times.
-  expect_fail(() =>
-              register(addon_id, name1, Telemetry.HISTOGRAM_LINEAR, 1, 5, 6));
-  // Make sure we can't get at it with another name.
-  expect_fail(() => Telemetry.getAddonHistogram(fake_addon_id, name1));
-
-  // Check for reflection capabilities.
-  var h1 = Telemetry.getAddonHistogram(addon_id, name1);
-  // Verify that although we've created storage for it, we don't reflect it into JS.
-  var snapshots = Telemetry.addonHistogramSnapshots;
-  do_check_false(name1 in snapshots[addon_id]);
-  h1.add(1);
-  h1.add(3);
-  var s1 = h1.snapshot();
-  do_check_eq(s1.histogram_type, Telemetry.HISTOGRAM_LINEAR);
-  do_check_eq(s1.min, 1);
-  do_check_eq(s1.max, 5);
-  do_check_eq(s1.counts[1], 1);
-  do_check_eq(s1.counts[3], 1);
-
-  var name2 = "testing-histogram2";
-  expect_success(() =>
-                 register(addon_id, name2, Telemetry.HISTOGRAM_LINEAR, 2, 4, 4));
-
-  var h2 = Telemetry.getAddonHistogram(addon_id, name2);
-  h2.add(2);
-  h2.add(3);
-  var s2 = h2.snapshot();
-  do_check_eq(s2.histogram_type, Telemetry.HISTOGRAM_LINEAR);
-  do_check_eq(s2.min, 2);
-  do_check_eq(s2.max, 4);
-  do_check_eq(s2.counts[1], 1);
-  do_check_eq(s2.counts[2], 1);
-
-  // Check that we can register histograms for a different addon with
-  // identical names.
-  var extra_addon = "testing-extra-addon";
-  expect_success(() =>
-                 register(extra_addon, name1, Telemetry.HISTOGRAM_BOOLEAN));
-
-  // Check that we can register flag histograms.
-  var flag_addon = "testing-flag-addon";
-  var flag_histogram = "flag-histogram";
-  expect_success(() =>
-                 register(flag_addon, flag_histogram, Telemetry.HISTOGRAM_FLAG));
-  expect_success(() =>
-                 register(flag_addon, name2, Telemetry.HISTOGRAM_LINEAR, 2, 4, 4));
-
-  // Check that we reflect registered addons and histograms.
-  snapshots = Telemetry.addonHistogramSnapshots;
-  do_check_true(addon_id in snapshots)
-  do_check_true(extra_addon in snapshots);
-  do_check_true(flag_addon in snapshots);
-
-  // Check that we have data for our created histograms.
-  do_check_true(name1 in snapshots[addon_id]);
-  do_check_true(name2 in snapshots[addon_id]);
-  var s1_alt = snapshots[addon_id][name1];
-  var s2_alt = snapshots[addon_id][name2];
-  do_check_eq(s1_alt.min, s1.min);
-  do_check_eq(s1_alt.max, s1.max);
-  do_check_eq(s1_alt.histogram_type, s1.histogram_type);
-  do_check_eq(s2_alt.min, s2.min);
-  do_check_eq(s2_alt.max, s2.max);
-  do_check_eq(s2_alt.histogram_type, s2.histogram_type);
-
-  // Even though we've registered it, it shouldn't show up until data is added to it.
-  do_check_false(name1 in snapshots[extra_addon]);
-
-  // Flag histograms should show up automagically.
-  do_check_true(flag_histogram in snapshots[flag_addon]);
-  do_check_false(name2 in snapshots[flag_addon]);
-
-  // Check that we can remove addon histograms.
-  Telemetry.unregisterAddonHistograms(addon_id);
-  snapshots = Telemetry.addonHistogramSnapshots;
-  do_check_false(addon_id in snapshots);
-  // Make sure other addons are unaffected.
-  do_check_true(extra_addon in snapshots);
-});
-
 add_task(function* test_expired_histogram() {
   var test_expired_id = "TELEMETRY_TEST_EXPIRED";
   var dummy = Telemetry.getHistogramById(test_expired_id);
   var rh = Telemetry.registeredHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, []);
   Assert.ok(!!rh);
 
   dummy.add(1);
 
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
@@ -38,18 +38,16 @@ const REASON_ENVIRONMENT_CHANGE = "envir
 
 const PLATFORM_VERSION = "1.9.2";
 const APP_VERSION = "1";
 const APP_ID = "xpcshell@tests.mozilla.org";
 const APP_NAME = "XPCShell";
 
 const IGNORE_HISTOGRAM_TO_CLONE = "MEMORY_HEAP_ALLOCATED";
 const IGNORE_CLONED_HISTOGRAM = "test::ignore_me_also";
-const ADDON_NAME = "Telemetry test addon";
-const ADDON_HISTOGRAM = "addon-histogram";
 // Add some unicode characters here to ensure that sending them works correctly.
 const SHUTDOWN_TIME = 10000;
 const FAILED_PROFILE_LOCK_ATTEMPTS = 2;
 
 // Constants from prio.h for nsIFileOutputStream.init
 const PR_WRONLY = 0x2;
 const PR_CREATE_FILE = 0x8;
 const PR_TRUNCATE = 0x20;
@@ -98,21 +96,16 @@ function fakeGenerateUUID(sessionFunc, s
 function fakeIdleNotification(topic) {
   let session = Cu.import("resource://gre/modules/TelemetrySession.jsm", {});
   return session.TelemetryScheduler.observe(null, topic, null);
 }
 
 function setupTestData() {
 
   Services.startup.interrupted = true;
-  Telemetry.registerAddonHistogram(ADDON_NAME, ADDON_HISTOGRAM,
-                                   Telemetry.HISTOGRAM_LINEAR,
-                                   1, 5, 6);
-  let h1 = Telemetry.getAddonHistogram(ADDON_NAME, ADDON_HISTOGRAM);
-  h1.add(1);
   let h2 = Telemetry.getHistogramById("TELEMETRY_TEST_COUNT");
   h2.add();
 
   let k1 = Telemetry.getKeyedHistogramById("TELEMETRY_TEST_KEYED_COUNT");
   k1.add("a");
   k1.add("a");
   k1.add("b");
 }
@@ -417,21 +410,16 @@ function checkPayload(payload, reason, s
   // because TelemetryController has separate logic for each one.  But we can't
   // currently check UNITS_COUNT_CUMULATIVE or UNITS_PERCENTAGE because
   // Telemetry doesn't touch a memory reporter with these units that's
   // available on all platforms.
 
   Assert.ok("MEMORY_JS_GC_HEAP" in payload.histograms); // UNITS_BYTES
   Assert.ok("MEMORY_JS_COMPARTMENTS_SYSTEM" in payload.histograms); // UNITS_COUNT
 
-  // We should have included addon histograms.
-  Assert.ok("addonHistograms" in payload);
-  Assert.ok(ADDON_NAME in payload.addonHistograms);
-  Assert.ok(ADDON_HISTOGRAM in payload.addonHistograms[ADDON_NAME]);
-
   Assert.ok(("mainThread" in payload.slowSQL) &&
                 ("otherThreads" in payload.slowSQL));
 
   Assert.ok(("IceCandidatesStats" in payload.webrtc) &&
                 ("webrtc" in payload.webrtc.IceCandidatesStats));
 
   // Check keyed histogram payload.
 
@@ -1910,17 +1898,17 @@ add_task(function* test_schedulerNothing
 
   yield TelemetryController.testShutdown();
   PingServer.resetPingHandler();
 });
 
 add_task(function* test_pingExtendedStats() {
   const EXTENDED_PAYLOAD_FIELDS = [
     "chromeHangs", "threadHangStats", "log", "slowSQL", "fileIOReports", "lateWrites",
-    "addonHistograms", "addonDetails", "webrtc"
+    "addonDetails", "webrtc"
   ];
 
   if (AppConstants.platform == "android") {
     EXTENDED_PAYLOAD_FIELDS.push("UIMeasurements");
   }
 
   // Reset telemetry and disable sending extended statistics.
   yield TelemetryStorage.testClearPendingPings();