Backed out changeset b8f6130e6997 (bug 1673664) for Build bustages. CLOSED TREE
authorDorel Luca <dluca@mozilla.com>
Thu, 05 Nov 2020 01:24:33 +0200
changeset 555936 9158256c5232e7acf7eb3e6143bfbd0ca691d009
parent 555935 639345ca2c28c8e97a98186d660dd8a4e68363ca
child 555937 33fbbff5e7252b70666d0c5eaedd4b1bb51a74b7
push id130223
push userdluca@mozilla.com
push dateWed, 04 Nov 2020 23:25:05 +0000
treeherderautoland@9158256c5232 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1673664
milestone84.0a1
backs outb8f6130e6997a1d3ab50011022959675c37bafcf
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
Backed out changeset b8f6130e6997 (bug 1673664) for Build bustages. CLOSED TREE
Cargo.lock
toolkit/components/glean/api/Cargo.toml
toolkit/components/glean/api/src/ffi/mod.rs
toolkit/components/glean/bindings/MetricTypes.h
toolkit/components/glean/bindings/private/Uuid.cpp
toolkit/components/glean/bindings/private/Uuid.h
toolkit/components/glean/build_scripts/glean_parser_ext/util.py
toolkit/components/glean/gtest/TestFog.cpp
toolkit/components/glean/moz.build
toolkit/components/glean/test_metrics.yaml
toolkit/components/glean/xpcom/nsIGleanMetrics.idl
toolkit/components/glean/xpcshell/test_Glean.js
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1532,20 +1532,18 @@ checksum = "2fad85553e09a6f881f739c29f0b
 
 [[package]]
 name = "fog"
 version = "0.1.0"
 dependencies = [
  "bincode",
  "chrono",
  "crossbeam-channel",
- "ffi-support",
  "glean-core",
  "log",
- "nsstring",
  "once_cell",
  "serde",
  "tempfile",
  "thiserror",
  "uuid",
  "xpcom",
 ]
 
--- a/toolkit/components/glean/api/Cargo.toml
+++ b/toolkit/components/glean/api/Cargo.toml
@@ -3,24 +3,22 @@ name = "fog"
 version = "0.1.0"
 authors = ["Glean SDK team <glean-team@mozilla.com>"]
 edition = "2018"
 publish = false
 
 [dependencies]
 bincode = "1.0"
 chrono = "0.4.10"
-ffi-support = "0.4"
 glean-core = "31.4.0"
 log = "0.4"
-nsstring = { path = "../../../../xpcom/rust/nsstring", optional = true }
 once_cell = "1.2.0"
 serde = { version = "1.0", features = ["derive"] }
 uuid = { version = "0.8.1", features = ["v4"] }
 xpcom = { path = "../../../../xpcom/rust/xpcom", optional = true }
 thiserror = "1.0.4"
 crossbeam-channel = "0.4.3"
 
 [dev-dependencies]
 tempfile = "3.1.0"
 
 [features]
-with_gecko = ["xpcom", "nsstring"]
+with_gecko = ["xpcom"]
--- a/toolkit/components/glean/api/src/ffi/mod.rs
+++ b/toolkit/components/glean/api/src/ffi/mod.rs
@@ -1,71 +1,19 @@
 // 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 https://mozilla.org/MPL/2.0/.
 
 #[macro_use]
 mod macros;
 
-use ffi_support::FfiStr;
-#[cfg(feature = "with_gecko")]
-use nsstring::nsACString;
-use uuid::Uuid;
-
 define_metric_ffi!(COUNTER_MAP {
     test_has -> fog_counter_test_has_value,
     test_get -> fog_counter_test_get_value: i32,
     add -> fog_counter_add(amount: i32),
 });
 
 define_metric_ffi!(TIMESPAN_MAP {
     test_has -> fog_timespan_test_has_value,
     test_get -> fog_timespan_test_get_value: u64,
     start -> fog_timespan_start(),
     stop -> fog_timespan_stop(),
 });
-
-// The Uuid functions are custom because test_get needs to use an outparam.
-// If we can make test_get optional, we can go back to using the macro to
-// generate the rest of the functions, or something.
-
-#[no_mangle]
-pub extern "C" fn fog_uuid_test_has_value(id: u32, storage_name: FfiStr) -> u8 {
-    match crate::metrics::__glean_metric_maps::UUID_MAP.get(&id.into()) {
-        Some(metric) => metric.test_get_value(storage_name.as_str()).is_some() as u8,
-        None => panic!("No metric for id {}", id),
-    }
-}
-
-#[cfg(feature = "with_gecko")]
-#[no_mangle]
-pub extern "C" fn fog_uuid_test_get_value(id: u32, storage_name: FfiStr, value: &mut nsACString) {
-    match crate::metrics::__glean_metric_maps::UUID_MAP.get(&id.into()) {
-        Some(uuid) => {
-            value.assign(
-                &uuid
-                    .test_get_value(storage_name.as_str())
-                    .unwrap()
-                    .to_string(),
-            );
-        }
-        None => panic!("No metric for id {}", id),
-    }
-}
-
-#[cfg(feature = "with_gecko")]
-#[no_mangle]
-pub extern "C" fn fog_uuid_set(id: u32, value: &nsACString) {
-    if let Ok(uuid) = Uuid::parse_str(&value.to_utf8()) {
-        match crate::metrics::__glean_metric_maps::UUID_MAP.get(&id.into()) {
-            Some(metric) => metric.set(uuid),
-            None => panic!("No metric for id {}", id),
-        }
-    }
-}
-
-#[no_mangle]
-pub extern "C" fn fog_uuid_generate_and_set(id: u32) {
-    match crate::metrics::__glean_metric_maps::UUID_MAP.get(&id.into()) {
-        Some(metric) => metric.generate_and_set(),
-        None => panic!("No metric for id {}", id),
-    }
-}
--- a/toolkit/components/glean/bindings/MetricTypes.h
+++ b/toolkit/components/glean/bindings/MetricTypes.h
@@ -2,11 +2,10 @@
  * 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/. */
 
 #ifndef mozilla_Glean_MetricTypes_h
 #define mozilla_Glean_MetricTypes_h
 
 #include "mozilla/glean/Counter.h"
 #include "mozilla/glean/Timespan.h"
-#include "mozilla/glean/Uuid.h"
 
 #endif  // mozilla_Glean_MetricTypes_h
deleted file mode 100644
--- a/toolkit/components/glean/bindings/private/Uuid.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#include "mozilla/glean/Uuid.h"
-
-#include "nsString.h"
-#include "mozilla/Components.h"
-#include "nsIClassInfoImpl.h"
-
-namespace mozilla {
-namespace glean {
-
-NS_IMPL_CLASSINFO(GleanUuid, nullptr, 0, {0})
-NS_IMPL_ISUPPORTS_CI(GleanUuid, nsIGleanUuid)
-
-NS_IMETHODIMP
-GleanUuid::Set(const nsACString& value, JSContext* cx) {
-  this->mUuid.Set(value);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-GleanUuid::GenerateAndSet(JSContext* cx) {
-  this->mUuid.GenerateAndSet();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-GleanUuid::TestHasValue(const nsACString& aStorageName, JSContext* cx,
-                        bool* result) {
-  *result = this->mUuid.TestHasValue(PromiseFlatCString(aStorageName).get());
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-GleanUuid::TestGetValue(const nsACString& aStorageName, JSContext* cx,
-                        nsACString& result) {
-  result.Assign(
-      this->mUuid.TestGetValue(PromiseFlatCString(aStorageName).get()));
-  return NS_OK;
-}
-
-}  // namespace glean
-}  // namespace mozilla
deleted file mode 100644
--- a/toolkit/components/glean/bindings/private/Uuid.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef mozilla_glean_GleanUuid_h
-#define mozilla_glean_GleanUuid_h
-
-#include "nsIGleanMetrics.h"
-#include "nsString.h"
-
-namespace mozilla {
-namespace glean {
-
-namespace impl {
-extern "C" {
-void fog_uuid_set(uint32_t id, const nsACString& uuid);
-void fog_uuid_generate_and_set(uint32_t id);
-uint32_t fog_uuid_test_has_value(uint32_t id, const char* storageName);
-void fog_uuid_test_get_value(uint32_t id, const char* storageName,
-                             nsACString& value);
-}
-
-class UuidMetric {
- public:
-  constexpr explicit UuidMetric(uint32_t id) : mId(id) {}
-
-  /*
-   * Sets to the specified value.
-   *
-   * @param value The UUID to set the metric to.
-   */
-  void Set(const nsACString& value) const { fog_uuid_set(mId, value); }
-
-  /*
-   * Generate a new random UUID and set the metric to it.
-   */
-  void GenerateAndSet() const { fog_uuid_generate_and_set(mId); }
-
-  /**
-   * **Test-only API**
-   *
-   * Tests whether a value is stored for the metric.
-   *
-   * This function will attempt to await the last parent-process task (if any)
-   * writing to the the metric's storage engine before returning a value.
-   * This function will not wait for data from child processes.
-   *
-   * Parent process only. Panics in child processes.
-   *
-   * @param aStorageName the name of the ping to retrieve the metric for.
-   * @return true if metric value exists, otherwise false
-   */
-  bool TestHasValue(const char* aStorageName) const {
-    return fog_uuid_test_has_value(mId, aStorageName) != 0;
-  }
-
-  /**
-   * **Test-only API**
-   *
-   * Gets the currently stored value as a hyphenated string.
-   *
-   * This function will attempt to await the last parent-process task (if any)
-   * writing to the the metric's storage engine before returning a value.
-   * This function will not wait for data from child processes.
-   *
-   * This doesn't clear the stored value.
-   * Parent process only. Panics in child processes.
-   * Panics if there is no value to get.
-   *
-   * @return value of the stored metric.
-   */
-  nsCString TestGetValue(const char* aStorageName) const {
-    nsCString ret;
-    fog_uuid_test_get_value(mId, aStorageName, ret);
-    return ret;
-  }
-
- private:
-  const uint32_t mId;
-};
-}  // namespace impl
-
-class GleanUuid final : public nsIGleanUuid {
- public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIGLEANUUID
-
-  explicit GleanUuid(uint32_t id) : mUuid(id){};
-
- private:
-  virtual ~GleanUuid() = default;
-
-  const impl::UuidMetric mUuid;
-};
-
-}  // namespace glean
-}  // namespace mozilla
-
-#endif /* mozilla_glean_GleanUuid.h */
--- a/toolkit/components/glean/build_scripts/glean_parser_ext/util.py
+++ b/toolkit/components/glean/build_scripts/glean_parser_ext/util.py
@@ -24,17 +24,17 @@ def generate_metric_ids(objs):
     for category_name, metrics in objs.items():
         for metric in metrics.values():
             metric_id_mapping[(category_name, metric.name)] = metric_id
             metric_id += 1
 
     return lambda metric: metric_id_mapping[(metric.category, metric.name)]
 
 
-IMPLEMENTED_CPP_TYPES = ["counter", "timespan", "uuid"]
+IMPLEMENTED_CPP_TYPES = ["counter", "timespan"]
 
 
 def is_implemented_metric_type(typ):
     """
     Filter out some unimplemented metric types to avoid generating C++ code for them.
     Once all types are implemented this code will be removed.
     """
     return typ in IMPLEMENTED_CPP_TYPES
--- a/toolkit/components/glean/gtest/TestFog.cpp
+++ b/toolkit/components/glean/gtest/TestFog.cpp
@@ -4,17 +4,16 @@
 
 #include "gtest/gtest.h"
 #include "mozilla/glean/GleanMetrics.h"
 
 #include "mozilla/Preferences.h"
 #include "nsString.h"
 
 using mozilla::Preferences;
-using namespace mozilla::glean;
 
 #define DATA_PREF "datareporting.healthreport.uploadEnabled"
 
 extern "C" {
 // This function is called by the rust code in test.rs if a non-fatal test
 // failure occurs.
 void GTest_FOG_ExpectFailure(const char* aMessage) {
   EXPECT_STREQ(aMessage, "");
@@ -65,23 +64,8 @@ TEST(FOG, TestCppTimespanWorks)
   PR_Sleep(PR_MillisecondsToInterval(10));
   mozilla::glean::test_only::can_we_time_it.Stop();
 
   ASSERT_TRUE(
       mozilla::glean::test_only::can_we_time_it.TestHasValue("test-ping"));
   ASSERT_TRUE(
       mozilla::glean::test_only::can_we_time_it.TestGetValue("test-ping") > 0);
 }
-
-TEST(FOG, TestCppUuidWorks)
-{
-  nsCString kTestUuid("decafdec-afde-cafd-ecaf-decafdecafde");
-  test_only::what_id_it.Set(kTestUuid);
-  ASSERT_TRUE(test_only::what_id_it.TestHasValue("test-ping"));
-  ASSERT_STREQ(kTestUuid.get(),
-               test_only::what_id_it.TestGetValue("test-ping").get());
-
-  test_only::what_id_it.GenerateAndSet();
-  // Since we generate v4 UUIDs, and the first character of the third group
-  // isn't 4, this won't ever collide with kTestUuid.
-  ASSERT_STRNE(kTestUuid.get(),
-               test_only::what_id_it.TestGetValue("test-ping").get());
-}
--- a/toolkit/components/glean/moz.build
+++ b/toolkit/components/glean/moz.build
@@ -19,25 +19,23 @@ if CONFIG["MOZ_GLEAN"]:
     EXPORTS.mozilla.glean += [
         "!GleanJSMetricsLookup.h",
         "!GleanMetrics.h",
         "bindings/Category.h",
         "bindings/Glean.h",
         "bindings/MetricTypes.h",
         "bindings/private/Counter.h",
         "bindings/private/Timespan.h",
-        "bindings/private/Uuid.h",
     ]
 
     UNIFIED_SOURCES += [
         "bindings/Category.cpp",
         "bindings/Glean.cpp",
         "bindings/private/Counter.cpp",
         "bindings/private/Timespan.cpp",
-        "bindings/private/Uuid.cpp",
         "ipc/FOGIPC.cpp",
     ]
 
     TEST_DIRS += [
         "gtest",
     ]
 
     XPCSHELL_TESTS_MANIFESTS += ["xpcshell/xpcshell.ini"]
--- a/toolkit/components/glean/test_metrics.yaml
+++ b/toolkit/components/glean/test_metrics.yaml
@@ -42,28 +42,16 @@ test_only:
     data_sensitivity:
       - technical
     notification_emails:
       - glean-team@mozilla.com
     expires: never
     send_in_pings:
       - test-ping
 
-  what_id_it: # Using a different metrics yaml style for fun.
-    type: uuid
-    description: |
-      Just a UUID.
-      This is a test-only metric.
-    bugs: [ "https://bugzilla.mozilla.org/show_bug.cgi?id=1673664" ]
-    data_reviews: [ "https://bugzilla.mozilla.org/show_bug.cgi?id=1673664#c1" ]
-    data_sensitivity: [ "technical" ]
-    notification_emails: [ "glean-team@mozilla.com" ]
-    expires: never
-    send_in_pings: [ "test-ping" ]
-
 test_only.ipc:
   a_counter:
     type: counter
     description: |
       This is a test-only metric.
       Just counting things.
     bugs:
       - https://bugzilla.mozilla.org/show_bug.cgi?id=1646165
--- a/toolkit/components/glean/xpcom/nsIGleanMetrics.idl
+++ b/toolkit/components/glean/xpcom/nsIGleanMetrics.idl
@@ -104,60 +104,8 @@ interface nsIGleanTimespan : nsISupports
    * This doesn't clear the stored value.
    * Parent process only. Panics in child processes.
    *
    * @return value of the stored metric.
    */
   [implicit_jscontext]
   long long testGetValue(in ACString aStorageName);
 };
-
-[scriptable, uuid(395700e7-06f6-46be-adcc-ea58977fda6d)]
-interface nsIGleanUuid : nsISupports
-{
-  /**
-   * Set to the specified value.
-   *
-   * @param aValue The UUID to set the metric to.
-   */
-  [implicit_jscontext]
-  void set(in ACString aValue);
-
-  /**
-   * Generate a new random UUID and set the metric to it.
-   */
-  [implicit_jscontext]
-  void generateAndSet();
-
-  /**
-   * **Test-only API**
-   *
-   * Tests whether a value is stored for the metric.
-   *
-   * This function will attempt to await the last parent-process task (if any)
-   * writing to the the metric's storage engine before returning a value.
-   * This function will not wait for data from child processes.
-   *
-   * Parent process only. Panics in child processes.
-   *
-   * @param aStorageName the name of the ping to retrieve the metric for.
-   * @return true if metric value exists, otherwise false
-   */
-  [implicit_jscontext]
-  bool testHasValue(in ACString aStorageName);
-
-  /**
-   * **Test-only API**
-   *
-   * Gets the currently stored value as an integer.
-   *
-   * This function will attempt to await the last parent-process task (if any)
-   * writing to the the metric's storage engine before returning a value.
-   * This function will not wait for data from child processes.
-   *
-   * This doesn't clear the stored value.
-   * Parent process only. Panics in child processes.
-   *
-   * @return value of the stored metric.
-   */
-  [implicit_jscontext]
-  ACString testGetValue(in ACString aStorageName);
-};
--- a/toolkit/components/glean/xpcshell/test_Glean.js
+++ b/toolkit/components/glean/xpcshell/test_Glean.js
@@ -37,23 +37,8 @@ add_task(async function test_fog_timespa
   // That guarantees some time to measure.
   Glean.test_only.can_we_time_it.start();
   await sleep(10);
   Glean.test_only.can_we_time_it.stop();
 
   Assert.ok(Glean.test_only.can_we_time_it.testHasValue("test-ping"));
   Assert.ok(Glean.test_only.can_we_time_it.testGetValue("test-ping") > 0);
 });
-
-add_task(async function test_fog_uuid_works() {
-  const kTestUuid = "decafdec-afde-cafd-ecaf-decafdecafde";
-  Glean.test_only.what_id_it.set(kTestUuid);
-  Assert.ok(Glean.test_only.what_id_it.testHasValue("test-ping"));
-  Assert.equal(kTestUuid, Glean.test_only.what_id_it.testGetValue("test-ping"));
-
-  Glean.test_only.what_id_it.generateAndSet();
-  // Since we generate v4 UUIDs, and the first character of the third group
-  // isn't 4, this won't ever collide with kTestUuid.
-  Assert.notEqual(
-    kTestUuid,
-    Glean.test_only.what_id_it.testGetValue("test-ping")
-  );
-});