From 63680ee634c01b2624df13367d58b2076406dd0c Mon Sep 17 00:00:00 2001 From: Travis Long Date: Mon, 24 Apr 2023 15:28:02 -0500 Subject: [PATCH 01/74] Bug 1829157 - Add accumulateSamples to docs --- .../reference/metrics/timing_distribution.md | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/docs/user/reference/metrics/timing_distribution.md b/docs/user/reference/metrics/timing_distribution.md index ecb6eaf7ae..5635a54965 100644 --- a/docs/user/reference/metrics/timing_distribution.md +++ b/docs/user/reference/metrics/timing_distribution.md @@ -239,6 +239,101 @@ Glean.pages.pageLoad.stopAndAccumulate(timerId); {{#include ../../../shared/tab_footer.md}} +### `accumulateSamples` + +Accumulates the provided signed samples in the metric. +This is required so that the platform-specific code can provide us with +64 bit signed integers if no `u64` comparable type is available. This +will take care of filtering and reporting errors for any provided negative +sample. + +Please note that this assumes that the provided samples are already in +the "unit" declared by the instance of the metric type (e.g. if the +instance this method was called on is using `TimeUnit::Second`, then +`samples` are assumed to be in that unit). + +{{#include ../../../shared/tab_header.md}} + +
+ +```Kotlin +import org.mozilla.yourApplication.GleanMetrics.Pages + +fun onPageLoaded(e: Event) { + Pages.pageLoad.accumulateSamples(samples) +} +``` + +
+
+ +```Java +import org.mozilla.yourApplication.GleanMetrics.Pages; + +void onPageLoaded(Event e) { + Pages.INSTANCE.pageLoad().accumulateSamples(samples); +} +``` + +
+
+ +```Swift +import Glean + +func onPageLoaded() { + Pages.pageLoad.accumulateSamples(samples) +} +``` + +
+
+ +```Python +from glean import load_metrics +metrics = load_metrics("metrics.yaml") + +class PageHandler: + def on_page_loaded(self, event): + metrics.pages.page_load.accumulate_samples(samples) +``` + +
+
+ +This API is not currently exposed in Rust, see [Bug 1829745](https://bugzilla.mozilla.org/show_bug.cgi?id=1829745). + +
+
+ +```Javascript +import * as pages from "./path/to/generated/files/pages.js"; + +function onPageLoaded() { + pages.pageLoad.accumulateSamples(samples); +} +``` + +
+
+ +This API is not currently exposed in Firefox Desktop, see [Bug 1829745](https://bugzilla.mozilla.org/show_bug.cgi?id=1829745). + +
+ +#### Limits + +- Samples are limited to the maximum value for the given time unit. +- Only non-negative values may be recorded (`>= 0`). + +#### Recorded Errors + +- Negative values are discarded and an `ErrorType::InvalidValue` is generated for each instance. +- Samples that are longer than maximum sample time for the given unit generate an `ErrorType::InvalidOverflow` error for each instance. + +{{#include ../../../shared/tab_footer.md}} + + #### Recorded errors * [`invalid_value`](../../user/metrics/error-reporting.md): If recording a negative timespan. From dd5c3eb403958c6abec1f32bb7d0828b4b8947c1 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Wed, 26 Apr 2023 10:59:39 +0200 Subject: [PATCH 02/74] Apply clippy lint: Avoid potential infinite loop Detailed explanation in https://rust-lang.github.io/rust-clippy/master/index.html#lines_filter_map_ok We're unlikely to hit this, because `entry` is a file and thus continued read errors are unlikely. But better be safe than sorry. --- glean-core/src/event_database/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glean-core/src/event_database/mod.rs b/glean-core/src/event_database/mod.rs index 09a9801fe7..e4e64e04d8 100644 --- a/glean-core/src/event_database/mod.rs +++ b/glean-core/src/event_database/mod.rs @@ -238,7 +238,7 @@ impl EventDatabase { db.insert( store_name, file.lines() - .filter_map(|line| line.ok()) + .map_while(Result::ok) .filter_map(|line| serde_json::from_str::(&line).ok()) .collect(), ); From 306fb0b3d4783360768aaac852ba734945a57cd1 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Tue, 25 Apr 2023 14:27:19 -0400 Subject: [PATCH 03/74] Update Kotlin to version 1.8.20 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a8fdd6e0e4..a612c26207 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { junit: '4.12', mockito: '3.11.2', mockwebserver: '4.9.1', // This is different than a-c, but we're fine, it's only tests. - kotlin: '1.8.10', + kotlin: '1.8.20', robolectric: '4.9.2', rust_android_plugin: '0.9.3', From c852fe4c00d6339b806e01bbea57a9a8eee9f85f Mon Sep 17 00:00:00 2001 From: Bruno Rosa Date: Mon, 1 May 2023 15:20:20 -0400 Subject: [PATCH 04/74] Bug 1812738 - allow user to set Glean log level --- CHANGELOG.md | 3 +++ docs/user/reference/general/initializing.md | 1 + .../java/mozilla/telemetry/glean/Glean.kt | 3 ++- .../telemetry/glean/config/Configuration.kt | 5 +++- .../ios/Glean/Config/Configuration.swift | 6 ++++- glean-core/ios/Glean/Glean.swift | 3 ++- glean-core/python/glean/glean.py | 1 + .../python/glean/net/ping_upload_worker.py | 1 + glean-core/rlb/src/configuration.rs | 9 +++++++ glean-core/rlb/src/lib.rs | 1 + glean-core/rlb/src/test.rs | 27 +++++++++++++++++++ glean-core/src/core/mod.rs | 2 ++ glean-core/src/glean.udl | 11 ++++++++ glean-core/src/lib.rs | 8 ++++++ glean-core/tests/common/mod.rs | 1 + samples/rust/src/main.rs | 1 + 16 files changed, 79 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b8115a500..ae7377e464 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ [Full changelog](https://github.com/mozilla/glean/compare/v52.6.0...main) +* General + * Allow user to configure how verbose the internal logging is ([#2459](https://github.com/mozilla/glean/pull/2459)) + # v52.6.0 (2023-04-20) [Full changelog](https://github.com/mozilla/glean/compare/v52.5.0...v52.6.0) diff --git a/docs/user/reference/general/initializing.md b/docs/user/reference/general/initializing.md index d920954247..cb458c7a7b 100644 --- a/docs/user/reference/general/initializing.md +++ b/docs/user/reference/general/initializing.md @@ -67,6 +67,7 @@ Below are listed the configuration options available on most SDKs. - `httpUploader`: A custom HTTP uploader instance, that will overwrite Glean's provided uploader. Useful for users that wish to use specific uploader implementations. See [Custom Uploaders](#custom-uploaders) for more information on how and when the use this feature. +- `logLevel`: The level for how verbose the internal logging is. The level filter options in order from least to most verbose are: `Off`, `Error`, `Warn`, `Info`, `Debug`, `Trace`. See the [`log` crate docs](https://docs.rs/log/latest/log/) for more information. To learn about SDK specific configuration options available, refer to the [Reference](#reference) section. diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt index e1eca4f88f..6325c02100 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt @@ -244,7 +244,8 @@ open class GleanInternalAPI internal constructor() { delayPingLifetimeIo = false, appBuild = "none", useCoreMps = false, - trimDataToRegisteredPings = false + trimDataToRegisteredPings = false, + logLevel = configuration.logLevel ) val clientInfo = getClientInfo(configuration, buildInfo) val callbacks = OnGleanEventsImpl(this@GleanInternalAPI) diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/config/Configuration.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/config/Configuration.kt index 8d9c85503b..dc76b152ac 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/config/Configuration.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/config/Configuration.kt @@ -4,6 +4,7 @@ package mozilla.telemetry.glean.config +import mozilla.telemetry.glean.internal.LevelFilter import mozilla.telemetry.glean.net.HttpURLConnectionUploader import mozilla.telemetry.glean.net.PingUploader @@ -18,6 +19,7 @@ import mozilla.telemetry.glean.net.PingUploader * sent along with all the pings, in the `client_info` section. * @property dataPath An optional [String] that specifies where to store data locally on the device. * This should ONLY be used when setting up Glean on a non-main process. + * @property logLevel An optional [LevelFilter] that controls how verbose the internal logging is. */ data class Configuration @JvmOverloads constructor( val serverEndpoint: String = DEFAULT_TELEMETRY_ENDPOINT, @@ -27,7 +29,8 @@ data class Configuration @JvmOverloads constructor( // default values for the lines below are ever changed, they are required // to change in the public constructor below. val httpClient: PingUploader = HttpURLConnectionUploader(), - val dataPath: String? = null + val dataPath: String? = null, + val logLevel: LevelFilter? = null ) { companion object { /** diff --git a/glean-core/ios/Glean/Config/Configuration.swift b/glean-core/ios/Glean/Config/Configuration.swift index 61b159988c..060b5a994f 100644 --- a/glean-core/ios/Glean/Config/Configuration.swift +++ b/glean-core/ios/Glean/Config/Configuration.swift @@ -9,6 +9,7 @@ public struct Configuration { let maxEvents: Int32? let channel: String? let dataPath: String? + let logLevel: LevelFilter? struct Constants { static let defaultTelemetryEndpoint = "https://incoming.telemetry.mozilla.org" @@ -23,15 +24,18 @@ public struct Configuration { /// * serverEndpoint the server endpoint Glean should send data to /// * dataPath an optional String that specifies where to store data locally on the device. /// This should ONLY be used when setting up Glean on a non-main process. + /// * logLevel an optional log level that controls how verbose the internal logging is. public init( maxEvents: Int32? = nil, channel: String? = nil, serverEndpoint: String? = nil, - dataPath: String? = nil + dataPath: String? = nil, + logLevel: LevelFilter? = nil ) { self.serverEndpoint = serverEndpoint ?? Constants.defaultTelemetryEndpoint self.maxEvents = maxEvents self.channel = channel self.dataPath = dataPath + self.logLevel = logLevel } } diff --git a/glean-core/ios/Glean/Glean.swift b/glean-core/ios/Glean/Glean.swift index c2bb57e1e7..7195ce7752 100644 --- a/glean-core/ios/Glean/Glean.swift +++ b/glean-core/ios/Glean/Glean.swift @@ -190,7 +190,8 @@ public class Glean { delayPingLifetimeIo: false, appBuild: "0.0.0", useCoreMps: false, - trimDataToRegisteredPings: false + trimDataToRegisteredPings: false, + logLevel: configuration.logLevel ) let clientInfo = getClientInfo(configuration, buildInfo: buildInfo) let callbacks = OnGleanEventsImpl(glean: self) diff --git a/glean-core/python/glean/glean.py b/glean-core/python/glean/glean.py index 3912954048..5a82495a22 100644 --- a/glean-core/python/glean/glean.py +++ b/glean-core/python/glean/glean.py @@ -230,6 +230,7 @@ def initialize( use_core_mps=False, app_build=cls._application_build_id, trim_data_to_registered_pings=False, + log_level=None, ) _uniffi.glean_initialize(cfg, client_info, callbacks) diff --git a/glean-core/python/glean/net/ping_upload_worker.py b/glean-core/python/glean/net/ping_upload_worker.py index 06f7e76b3d..b843c00442 100644 --- a/glean-core/python/glean/net/ping_upload_worker.py +++ b/glean-core/python/glean/net/ping_upload_worker.py @@ -120,6 +120,7 @@ def _process(data_dir: Path, application_id: str, configuration) -> bool: use_core_mps=False, app_build="", trim_data_to_registered_pings=False, + log_level=None, ) if not glean_initialize_for_subprocess(cfg): log.error("Couldn't initialize Glean in subprocess") diff --git a/glean-core/rlb/src/configuration.rs b/glean-core/rlb/src/configuration.rs index 4a18d1acdc..145f1a5732 100644 --- a/glean-core/rlb/src/configuration.rs +++ b/glean-core/rlb/src/configuration.rs @@ -2,6 +2,8 @@ // 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/. +use log::LevelFilter; + use crate::net::PingUploader; use std::path::PathBuf; @@ -34,6 +36,8 @@ pub struct Configuration { /// Unless you know that all your and your libraries' pings are appropriately registered /// _before_ init, you shouldn't use this. pub trim_data_to_registered_pings: bool, + /// The internal logging level. + pub log_level: Option, } /// Configuration builder. @@ -68,6 +72,9 @@ pub struct Builder { /// _before_ init, you shouldn't use this. /// Default: `false` pub trim_data_to_registered_pings: bool, + /// Optional: The internal logging level. + /// Default: `None` + pub log_level: Option, } impl Builder { @@ -87,6 +94,7 @@ impl Builder { uploader: None, use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, } } @@ -102,6 +110,7 @@ impl Builder { uploader: self.uploader, use_core_mps: self.use_core_mps, trim_data_to_registered_pings: self.trim_data_to_registered_pings, + log_level: self.log_level, } } diff --git a/glean-core/rlb/src/lib.rs b/glean-core/rlb/src/lib.rs index f4311a434b..d6ad16bdc1 100644 --- a/glean-core/rlb/src/lib.rs +++ b/glean-core/rlb/src/lib.rs @@ -118,6 +118,7 @@ fn initialize_internal(cfg: Configuration, client_info: ClientInfoMetrics) -> Op app_build: client_info.app_build.clone(), use_core_mps: cfg.use_core_mps, trim_data_to_registered_pings: cfg.trim_data_to_registered_pings, + log_level: cfg.log_level, }; glean_core::glean_initialize(core_cfg, client_info.into(), callbacks); diff --git a/glean-core/rlb/src/test.rs b/glean-core/rlb/src/test.rs index bad395f9cd..bca1993d0b 100644 --- a/glean-core/rlb/src/test.rs +++ b/glean-core/rlb/src/test.rs @@ -53,6 +53,7 @@ fn send_a_ping() { uploader: Some(Box::new(FakeUploader { sender: s })), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }; let _t = new_glean(Some(cfg), true); @@ -142,6 +143,7 @@ fn test_experiments_recording_before_glean_inits() { uploader: None, use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }, ClientInfoMetrics::unknown(), false, @@ -202,6 +204,7 @@ fn sending_of_foreground_background_pings() { uploader: Some(Box::new(FakeUploader { sender: s })), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }; let _t = new_glean(Some(cfg), true); @@ -284,6 +287,7 @@ fn sending_of_startup_baseline_ping() { uploader: Some(Box::new(FakeUploader { sender: s })), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }, ClientInfoMetrics::unknown(), false, @@ -343,6 +347,7 @@ fn no_dirty_baseline_on_clean_shutdowns() { uploader: Some(Box::new(FakeUploader { sender: s })), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }, ClientInfoMetrics::unknown(), false, @@ -373,6 +378,7 @@ fn initialize_must_not_crash_if_data_dir_is_messed_up() { uploader: None, use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }; test_reset_glean(cfg, ClientInfoMetrics::unknown(), false); @@ -419,6 +425,7 @@ fn queued_recorded_metrics_correctly_record_during_init() { uploader: None, use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }; let _t = new_glean(Some(cfg), false); @@ -445,6 +452,7 @@ fn initializing_twice_is_a_noop() { uploader: None, use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }, ClientInfoMetrics::unknown(), true, @@ -465,6 +473,7 @@ fn initializing_twice_is_a_noop() { uploader: None, use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }, ClientInfoMetrics::unknown(), ); @@ -493,6 +502,7 @@ fn dont_handle_events_when_uninitialized() { uploader: None, use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }, ClientInfoMetrics::unknown(), true, @@ -557,6 +567,7 @@ fn the_app_channel_must_be_correctly_set_if_requested() { uploader: None, use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }, client_info, true, @@ -579,6 +590,7 @@ fn the_app_channel_must_be_correctly_set_if_requested() { uploader: None, use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }, client_info, true, @@ -642,6 +654,7 @@ fn ping_collection_must_happen_after_concurrently_scheduled_metrics_recordings() uploader: Some(Box::new(FakeUploader { sender: s })), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }, ClientInfoMetrics::unknown(), true, @@ -723,6 +736,7 @@ fn core_metrics_should_be_cleared_and_restored_when_disabling_and_enabling_uploa uploader: None, use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }, ClientInfoMetrics::unknown(), true, @@ -785,6 +799,7 @@ fn sending_deletion_ping_if_disabled_outside_of_run() { uploader: None, use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }; let _t = new_glean(Some(cfg), true); @@ -802,6 +817,7 @@ fn sending_deletion_ping_if_disabled_outside_of_run() { uploader: Some(Box::new(FakeUploader { sender: s })), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }, ClientInfoMetrics::unknown(), false, @@ -850,6 +866,7 @@ fn no_sending_of_deletion_ping_if_unchanged_outside_of_run() { uploader: None, use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }; let _t = new_glean(Some(cfg), true); @@ -867,6 +884,7 @@ fn no_sending_of_deletion_ping_if_unchanged_outside_of_run() { uploader: Some(Box::new(FakeUploader { sender: s })), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }, ClientInfoMetrics::unknown(), false, @@ -923,6 +941,7 @@ fn test_sending_of_startup_baseline_ping_with_application_lifetime_metric() { uploader: None, use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }, ClientInfoMetrics::unknown(), true, @@ -955,6 +974,7 @@ fn test_sending_of_startup_baseline_ping_with_application_lifetime_metric() { uploader: Some(Box::new(FakeUploader { sender: s })), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }, ClientInfoMetrics::unknown(), false, @@ -1013,6 +1033,7 @@ fn setting_debug_view_tag_before_initialization_should_not_crash() { uploader: Some(Box::new(FakeUploader { sender: s })), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }; let _t = new_glean(Some(cfg), true); @@ -1071,6 +1092,7 @@ fn setting_source_tags_before_initialization_should_not_crash() { uploader: Some(Box::new(FakeUploader { sender: s })), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }; let _t = new_glean(Some(cfg), true); @@ -1128,6 +1150,7 @@ fn setting_source_tags_after_initialization_should_not_crash() { uploader: Some(Box::new(FakeUploader { sender: s })), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }; let _t = new_glean(Some(cfg), true); @@ -1199,6 +1222,7 @@ fn flipping_upload_enabled_respects_order_of_events() { uploader: Some(Box::new(FakeUploader { sender: s })), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }; // We create a ping and a metric before we initialize Glean @@ -1267,6 +1291,7 @@ fn registering_pings_before_init_must_work() { uploader: Some(Box::new(FakeUploader { sender: s })), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }; let _t = new_glean(Some(cfg), true); @@ -1317,6 +1342,7 @@ fn test_a_ping_before_submission() { uploader: Some(Box::new(FakeUploader { sender: s })), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }; let _t = new_glean(Some(cfg), true); @@ -1445,6 +1471,7 @@ fn signaling_done() { })), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }; let _t = new_glean(Some(cfg), true); diff --git a/glean-core/src/core/mod.rs b/glean-core/src/core/mod.rs index af7d694953..29ee1e52c7 100644 --- a/glean-core/src/core/mod.rs +++ b/glean-core/src/core/mod.rs @@ -112,6 +112,7 @@ where /// app_build: "".into(), /// use_core_mps: false, /// trim_data_to_registered_pings: false, +/// log_level: None, /// }; /// let mut glean = Glean::new(cfg).unwrap(); /// let ping = PingType::new("sample", true, false, vec![]); @@ -293,6 +294,7 @@ impl Glean { app_build: "Unknown".into(), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }; let mut glean = Self::new(cfg).unwrap(); diff --git a/glean-core/src/glean.udl b/glean-core/src/glean.udl index bbbe7f04f5..67466b4640 100644 --- a/glean-core/src/glean.udl +++ b/glean-core/src/glean.udl @@ -69,6 +69,17 @@ dictionary InternalConfiguration { string app_build; boolean use_core_mps; boolean trim_data_to_registered_pings; + LevelFilter? log_level; +}; + +// An enum representing the different logging levels for the `log` crate. +enum LevelFilter { + "Off", + "Error", + "Warn", + "Info", + "Debug", + "Trace", }; // Values for the `client_info` metrics. diff --git a/glean-core/src/lib.rs b/glean-core/src/lib.rs index d03d901ffa..83427762ed 100644 --- a/glean-core/src/lib.rs +++ b/glean-core/src/lib.rs @@ -25,6 +25,7 @@ use std::thread; use std::time::Duration; use crossbeam_channel::unbounded; +use log::{self, LevelFilter}; use once_cell::sync::{Lazy, OnceCell}; use uuid::Uuid; @@ -125,6 +126,8 @@ pub struct InternalConfiguration { pub use_core_mps: bool, /// Whether Glean should, on init, trim its event storage to only the registered pings. pub trim_data_to_registered_pings: bool, + /// The internal logging level. + pub log_level: Option, } /// Launches a new task on the global dispatch queue with a reference to the Glean singleton. @@ -306,6 +309,11 @@ fn initialize_inner( let upload_enabled = cfg.upload_enabled; let trim_data_to_registered_pings = cfg.trim_data_to_registered_pings; + // Set the internal logging level. + if let Some(level) = cfg.log_level { + log::set_max_level(level) + } + let glean = match Glean::new(cfg) { Ok(glean) => glean, Err(err) => { diff --git a/glean-core/tests/common/mod.rs b/glean-core/tests/common/mod.rs index 7c8c9836f1..34072b0389 100644 --- a/glean-core/tests/common/mod.rs +++ b/glean-core/tests/common/mod.rs @@ -59,6 +59,7 @@ pub fn new_glean(tempdir: Option) -> (Glean, tempfile::TempDi app_build: "Unknown".into(), use_core_mps: false, trim_data_to_registered_pings: false, + log_level: None, }; let glean = Glean::new(cfg).unwrap(); diff --git a/samples/rust/src/main.rs b/samples/rust/src/main.rs index ee5e24c65a..82412580b2 100644 --- a/samples/rust/src/main.rs +++ b/samples/rust/src/main.rs @@ -37,6 +37,7 @@ fn main() { uploader: None, use_core_mps: true, trim_data_to_registered_pings: false, + log_level: None, }; let client_info = ClientInfoMetrics { From 280e980aef669f30776e9458914d641d2ecf0c29 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Fri, 5 May 2023 08:36:11 -0400 Subject: [PATCH 05/74] Synchronize Gradle dependencies with Android Components --- CHANGELOG.md | 2 ++ build.gradle | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae7377e464..b5a2a6ce98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ * General * Allow user to configure how verbose the internal logging is ([#2459](https://github.com/mozilla/glean/pull/2459)) +* Kotlin + * Update Kotlin to version 1.8.21 ([#2462](https://github.com/mozilla/glean/pull/2462)) # v52.6.0 (2023-04-20) diff --git a/build.gradle b/build.gradle index a612c26207..a559ecd1a1 100644 --- a/build.gradle +++ b/build.gradle @@ -11,24 +11,24 @@ buildscript { // changing them. Please note that, for using in Android-Components, the // versions below must match the ones in that repository. ext.versions = [ - android_gradle_plugin: '7.4.1', + android_gradle_plugin: '7.4.2', coroutines: '1.6.4', jna: '5.13.0', junit: '4.12', mockito: '3.11.2', mockwebserver: '4.9.1', // This is different than a-c, but we're fine, it's only tests. - kotlin: '1.8.20', - robolectric: '4.9.2', + kotlin: '1.8.21', + robolectric: '4.10.1', rust_android_plugin: '0.9.3', // Android X dependencies - androidx_annotation: '1.5.0', - androidx_appcompat: '1.3.0', - androidx_browser: '1.3.0', - androidx_core: '1.9.0', + androidx_annotation: '1.6.0', + androidx_appcompat: '1.6.1', + androidx_browser: '1.5.0', + androidx_core: '1.10.0', androidx_espresso: '3.5.1', androidx_junit: '1.1.5', - androidx_lifecycle: '2.5.1', + androidx_lifecycle: '2.6.1', androidx_test: '1.5.0', androidx_work: '2.7.1', androidx_uiautomator: '2.2.0', From 7fa05463c24b8ea0c746d3aa6fe51d6a097cd4d5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 May 2023 05:56:46 +0000 Subject: [PATCH 06/74] Bump flake8-bugbear from 23.3.23 to 23.5.9 in /glean-core/python Bumps [flake8-bugbear](https://github.com/PyCQA/flake8-bugbear) from 23.3.23 to 23.5.9. - [Release notes](https://github.com/PyCQA/flake8-bugbear/releases) - [Commits](https://github.com/PyCQA/flake8-bugbear/compare/23.3.23...23.5.9) --- updated-dependencies: - dependency-name: flake8-bugbear dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- glean-core/python/requirements_dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glean-core/python/requirements_dev.txt b/glean-core/python/requirements_dev.txt index d71d74a16a..959497dd85 100644 --- a/glean-core/python/requirements_dev.txt +++ b/glean-core/python/requirements_dev.txt @@ -2,7 +2,7 @@ auditwheel==5.3.0 black==23.3.0; python_version > '3.6' coverage==7.2.2; python_version > '3.6' flake8==6.0.0; python_version >= '3.8' -flake8-bugbear==23.3.23; python_version >= '3.8' +flake8-bugbear==23.5.9; python_version >= '3.8' jsonschema==3.2.0 mypy==1.2.0; python_version > '3.6' pdoc3==0.10.0 From b45cb190cec5051046d8def8ed1996a3de8f159d Mon Sep 17 00:00:00 2001 From: Travis Long Date: Mon, 8 May 2023 14:31:28 -0500 Subject: [PATCH 07/74] Bug 1830937 - Make `setLogPings` and `setDebugViewTag` public for Android --- CHANGELOG.md | 1 + .../android/src/main/java/mozilla/telemetry/glean/Glean.kt | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5a2a6ce98..574a313382 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Allow user to configure how verbose the internal logging is ([#2459](https://github.com/mozilla/glean/pull/2459)) * Kotlin * Update Kotlin to version 1.8.21 ([#2462](https://github.com/mozilla/glean/pull/2462)) + * Make debugging APIs available on Android ([Bug 1830937](https://bugzilla.mozilla.org/show_bug.cgi?id=1830937)) # v52.6.0 (2023-04-20) diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt index 6325c02100..7198f3e5b2 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt @@ -422,7 +422,7 @@ open class GleanInternalAPI internal constructor() { * * @param value The value of the tag, which must be a valid HTTP header value. */ - internal fun setDebugViewTag(value: String): Boolean { + fun setDebugViewTag(value: String): Boolean { return gleanSetDebugViewTag(value) } @@ -479,7 +479,7 @@ open class GleanInternalAPI internal constructor() { * * @param value The value of the option. */ - internal fun setLogPings(value: Boolean) { + fun setLogPings(value: Boolean) { gleanSetLogPings(value) } From 5f4b8f2f9431e7b4777f65c6f678d9c8540d495e Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Wed, 3 May 2023 12:45:16 +0200 Subject: [PATCH 08/74] At shutdown block with a timeout and bail out if that fails. --- glean-core/src/dispatcher/global.rs | 7 +++++++ glean-core/src/dispatcher/mod.rs | 23 ++++++++++++++++++++++- glean-core/src/lib.rs | 14 ++++++++++++-- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/glean-core/src/dispatcher/global.rs b/glean-core/src/dispatcher/global.rs index fec5bb6365..f90a681a5e 100644 --- a/glean-core/src/dispatcher/global.rs +++ b/glean-core/src/dispatcher/global.rs @@ -6,8 +6,10 @@ use once_cell::sync::Lazy; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::RwLock; use std::thread; +use std::time::Duration; use super::{DispatchError, DispatchGuard, Dispatcher}; +use crossbeam_channel::RecvTimeoutError; #[cfg(feature = "preinit_million_queue")] pub const GLOBAL_DISPATCHER_LIMIT: usize = 1000000; @@ -76,6 +78,11 @@ pub fn block_on_queue() { guard().block_on_queue(); } +/// Block until all tasks prior to this call are processed, with a timeout. +pub fn block_on_queue_timeout(timeout: Duration) -> Result<(), RecvTimeoutError> { + guard().block_on_queue_timeout(timeout) +} + /// Starts processing queued tasks in the global dispatch queue. /// /// This function blocks until queued tasks prior to this call are finished. diff --git a/glean-core/src/dispatcher/mod.rs b/glean-core/src/dispatcher/mod.rs index 17f7f5df0b..257695c34e 100644 --- a/glean-core/src/dispatcher/mod.rs +++ b/glean-core/src/dispatcher/mod.rs @@ -29,9 +29,10 @@ use std::{ Arc, }, thread::{self, JoinHandle}, + time::Duration, }; -use crossbeam_channel::{bounded, unbounded, SendError, Sender}; +use crossbeam_channel::{bounded, unbounded, RecvTimeoutError, SendError, Sender}; use thiserror::Error; pub use global::*; @@ -161,6 +162,26 @@ impl DispatchGuard { .expect("Failed to receive message on single-use channel"); } + /// Block on the task queue emptying, with a timeout. + fn block_on_queue_timeout(&self, timeout: Duration) -> Result<(), RecvTimeoutError> { + let (tx, rx) = crossbeam_channel::bounded(0); + + // We explicitly don't use `self.launch` here. + // We always put this task on the unbounded queue. + // The pre-init queue might be full before its flushed, in which case this would panic. + // Blocking on the queue can only work if it is eventually flushed anyway. + + let task = Command::Task(Box::new(move || { + tx.send(()) + .expect("(worker) Can't send message on single-use channel"); + })); + self.sender + .send(task) + .expect("Failed to launch the blocking task"); + + rx.recv_timeout(timeout) + } + fn kill(&mut self) -> Result<(), DispatchError> { // We immediately stop queueing in the pre-init buffer. let old_val = self.queue_preinit.swap(false, Ordering::SeqCst); diff --git a/glean-core/src/lib.rs b/glean-core/src/lib.rs index 83427762ed..dd53f107a6 100644 --- a/glean-core/src/lib.rs +++ b/glean-core/src/lib.rs @@ -565,8 +565,18 @@ pub fn shutdown() { glean.set_dirty_flag(false); }); - // We need to wait for above task to finish. - dispatcher::block_on_queue(); + // We need to wait for above task to finish, + // but we also don't wait around forever. + // + // TODO: Make the timeout configurable? + // The default hang watchdog on Firefox waits 60s, + // Glean's `uploader_shutdown` further below waits up to 30s. + if dispatcher::block_on_queue_timeout(Duration::from_secs(10)).is_err() { + log::error!( + "Timeout while blocking on the dispatcher. No further shutdown cleanup will happen." + ); + return; + } if let Err(e) = dispatcher::shutdown() { log::error!("Can't shutdown dispatcher thread: {:?}", e); From ce37542b8f7944c807a1c6e408dd27279619511e Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Thu, 4 May 2023 19:27:40 +0200 Subject: [PATCH 09/74] Instrument wait time for the dispatcher at shutdown --- glean-core/metrics.yaml | 17 +++++++++++++++++ glean-core/src/internal_metrics.rs | 15 +++++++++++++++ glean-core/src/lib.rs | 13 +++++++++++++ 3 files changed, 45 insertions(+) diff --git a/glean-core/metrics.yaml b/glean-core/metrics.yaml index e52c1704c1..bf7cb418e0 100644 --- a/glean-core/metrics.yaml +++ b/glean-core/metrics.yaml @@ -744,6 +744,23 @@ glean.validation: - jrediger@mozilla.com expires: never + shutdown_dispatcher_wait: + type: timing_distribution + time_unit: millisecond + description: | + Time waited for the dispatcher to unblock during shutdown. + Most samples are expected to be below the 10s timeout used. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1828066 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1828066#c7 + data_sensitivity: + - technical + notification_emails: + - glean-team@mozilla.com + - jrediger@mozilla.com + expires: never + glean: restarted: type: event diff --git a/glean-core/src/internal_metrics.rs b/glean-core/src/internal_metrics.rs index 897d04437a..1a1c5576f2 100644 --- a/glean-core/src/internal_metrics.rs +++ b/glean-core/src/internal_metrics.rs @@ -24,6 +24,9 @@ pub struct AdditionalMetrics { /// Time waited for the uploader at shutdown. pub shutdown_wait: TimingDistributionMetric, + + /// Time waited for the dispatcher to unblock during shutdown. + pub shutdown_dispatcher_wait: TimingDistributionMetric, } impl CoreMetrics { @@ -97,6 +100,18 @@ impl AdditionalMetrics { }, TimeUnit::Millisecond, ), + + shutdown_dispatcher_wait: TimingDistributionMetric::new( + CommonMetricData { + name: "shutdown_dispatcher_wait".into(), + category: "glean.validation".into(), + send_in_pings: vec!["metrics".into()], + lifetime: Lifetime::Ping, + disabled: false, + dynamic_label: None, + }, + TimeUnit::Millisecond, + ), } } } diff --git a/glean-core/src/lib.rs b/glean-core/src/lib.rs index dd53f107a6..7d6ea2f179 100644 --- a/glean-core/src/lib.rs +++ b/glean-core/src/lib.rs @@ -571,12 +571,25 @@ pub fn shutdown() { // TODO: Make the timeout configurable? // The default hang watchdog on Firefox waits 60s, // Glean's `uploader_shutdown` further below waits up to 30s. + let timer_id = core::with_glean(|glean| { + glean + .additional_metrics + .shutdown_dispatcher_wait + .start_sync() + }); if dispatcher::block_on_queue_timeout(Duration::from_secs(10)).is_err() { log::error!( "Timeout while blocking on the dispatcher. No further shutdown cleanup will happen." ); return; } + let stop_time = time::precise_time_ns(); + core::with_glean(|glean| { + glean + .additional_metrics + .shutdown_dispatcher_wait + .set_stop_and_accumulate(glean, timer_id, stop_time); + }); if let Err(e) = dispatcher::shutdown() { log::error!("Can't shutdown dispatcher thread: {:?}", e); From d4ffbf3d4aa6f0245846d408304231cb77a494b1 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Wed, 10 May 2023 10:53:27 +0200 Subject: [PATCH 10/74] Document new timeout-at-shutdown feature --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 574a313382..18897c7666 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ * General * Allow user to configure how verbose the internal logging is ([#2459](https://github.com/mozilla/glean/pull/2459)) + * Added a timeout waiting for the dispatcher at shutdown ([#2461](https://github.com/mozilla/glean/pull/2461)) + * Added a new Glean metric `glean.validation.shutdown_dispatcher_wait` measuring the wait time at shutdown ([#2461](https://github.com/mozilla/glean/pull/2461)) * Kotlin * Update Kotlin to version 1.8.21 ([#2462](https://github.com/mozilla/glean/pull/2462)) * Make debugging APIs available on Android ([Bug 1830937](https://bugzilla.mozilla.org/show_bug.cgi?id=1830937)) From c501555ad63051a4d5813957c67ae783afef1996 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Wed, 10 May 2023 11:02:29 +0200 Subject: [PATCH 11/74] Bumped version to 52.7.0 --- .buildconfig.yml | 2 +- CHANGELOG.md | 6 +++++- Cargo.lock | 4 ++-- DEPENDENCIES.md | 4 ++-- glean-core/Cargo.toml | 2 +- glean-core/python/setup.py | 2 +- glean-core/rlb/Cargo.toml | 4 ++-- .../telemetry/glean-gradle-plugin/GleanGradlePlugin.groovy | 2 +- 8 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.buildconfig.yml b/.buildconfig.yml index c409b080c9..4a79ee0ca4 100644 --- a/.buildconfig.yml +++ b/.buildconfig.yml @@ -1,4 +1,4 @@ -libraryVersion: 52.6.0 +libraryVersion: 52.7.0 groupId: org.mozilla.telemetry projects: glean: diff --git a/CHANGELOG.md b/CHANGELOG.md index 18897c7666..b6b9b98f32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Unreleased changes -[Full changelog](https://github.com/mozilla/glean/compare/v52.6.0...main) +[Full changelog](https://github.com/mozilla/glean/compare/v52.7.0...main) + +# v52.7.0 (2023-05-10) + +[Full changelog](https://github.com/mozilla/glean/compare/v52.6.0...v52.7.0) * General * Allow user to configure how verbose the internal logging is ([#2459](https://github.com/mozilla/glean/pull/2459)) diff --git a/Cargo.lock b/Cargo.lock index d7eb2a5393..be776e4ab7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -318,7 +318,7 @@ dependencies = [ [[package]] name = "glean" -version = "52.6.0" +version = "52.7.0" dependencies = [ "chrono", "crossbeam-channel", @@ -361,7 +361,7 @@ dependencies = [ [[package]] name = "glean-core" -version = "52.6.0" +version = "52.7.0" dependencies = [ "android_logger", "bincode", diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index 52fd64960a..d8a198ac46 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -4543,9 +4543,9 @@ You may use this code under the terms of either license. The following text applies to code linked from these dependencies: -* [glean 52.6.0]( https://github.com/mozilla/glean ) +* [glean 52.7.0]( https://github.com/mozilla/glean ) * [glean-build 7.1.0]( https://github.com/mozilla/glean ) -* [glean-core 52.6.0]( https://github.com/mozilla/glean ) +* [glean-core 52.7.0]( https://github.com/mozilla/glean ) * [zeitstempel 0.1.1]( https://github.com/badboy/zeitstempel ) ``` diff --git a/glean-core/Cargo.toml b/glean-core/Cargo.toml index d191031066..575680085f 100644 --- a/glean-core/Cargo.toml +++ b/glean-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "glean-core" -version = "52.6.0" +version = "52.7.0" authors = ["Jan-Erik Rediger ", "The Glean Team "] description = "A modern Telemetry library" repository = "https://github.com/mozilla/glean" diff --git a/glean-core/python/setup.py b/glean-core/python/setup.py index e7b7afca92..475dc89a57 100644 --- a/glean-core/python/setup.py +++ b/glean-core/python/setup.py @@ -56,7 +56,7 @@ history = history_file.read() # glean version. Automatically updated by the bin/prepare_release.sh script -version = "52.6.0" +version = "52.7.0" requirements = [ "semver>=2.13.0", diff --git a/glean-core/rlb/Cargo.toml b/glean-core/rlb/Cargo.toml index 9dd21932f5..08670ce5fe 100644 --- a/glean-core/rlb/Cargo.toml +++ b/glean-core/rlb/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "glean" -version = "52.6.0" +version = "52.7.0" authors = ["Jan-Erik Rediger ", "The Glean Team "] description = "Glean SDK Rust language bindings" repository = "https://github.com/mozilla/glean" @@ -23,7 +23,7 @@ maintenance = { status = "actively-developed" } [dependencies.glean-core] path = ".." -version = "52.6.0" +version = "52.7.0" [dependencies] crossbeam-channel = "0.5" diff --git a/gradle-plugin/src/main/groovy/mozilla/telemetry/glean-gradle-plugin/GleanGradlePlugin.groovy b/gradle-plugin/src/main/groovy/mozilla/telemetry/glean-gradle-plugin/GleanGradlePlugin.groovy index d04903a19e..ff7166c985 100644 --- a/gradle-plugin/src/main/groovy/mozilla/telemetry/glean-gradle-plugin/GleanGradlePlugin.groovy +++ b/gradle-plugin/src/main/groovy/mozilla/telemetry/glean-gradle-plugin/GleanGradlePlugin.groovy @@ -555,7 +555,7 @@ except: void apply(Project project) { isOffline = project.gradle.startParameter.offline - project.ext.glean_version = "52.6.0" + project.ext.glean_version = "52.7.0" def parserVersion = gleanParserVersion(project) // Print the required glean_parser version to the console. This is From cc48078e3fc33e9cb622515de433b5d2d4ab38e3 Mon Sep 17 00:00:00 2001 From: Beatriz Rizental Date: Wed, 10 May 2023 16:02:02 +0200 Subject: [PATCH 12/74] Proposal: Make Glean Swift logs public by default (#2469) Ok so, when I try to see Glean logs from an iOS device using `log` I just get `` for all Glean messages. According to [this Stack Overflow](https://stackoverflow.com/questions/45908875/apple-iphone-debugging-with-console-private) that is because all dynamic strings are by default private. I made this change locally and I can now see the messages, would it be possible to get this merged? Thanks! --- glean-core/ios/Glean/Utils/Logger.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glean-core/ios/Glean/Utils/Logger.swift b/glean-core/ios/Glean/Utils/Logger.swift index 1316cb64ad..4d0a7bbf3e 100644 --- a/glean-core/ios/Glean/Utils/Logger.swift +++ b/glean-core/ios/Glean/Utils/Logger.swift @@ -49,6 +49,6 @@ class Logger { /// * message: The message to log /// * level: The `LogLevel` at which to output the message private func log(_ message: String, type: OSLogType) { - os_log("%@", log: self.log, type: type, message) + os_log("%{public}@", log: self.log, type: type, message) } } From ecf2d9e2227cc1c8e6cd3bcdf1e3f8a4b8d8823a Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Wed, 10 May 2023 11:29:39 +0200 Subject: [PATCH 13/74] Pruned cargo-vet config Using `cargo vet prune` --- supply-chain/config.toml | 16 ---------------- supply-chain/imports.lock | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/supply-chain/config.toml b/supply-chain/config.toml index 0d2bc337f1..ffa60db12a 100644 --- a/supply-chain/config.toml +++ b/supply-chain/config.toml @@ -64,14 +64,6 @@ criteria = "safe-to-deploy" version = "1.3.0" criteria = "safe-to-deploy" -[[exemptions.camino]] -version = "1.1.4" -criteria = "safe-to-deploy" - -[[exemptions.cargo-platform]] -version = "0.1.2" -criteria = "safe-to-deploy" - [[exemptions.cc]] version = "1.0.78" criteria = "safe-to-deploy" @@ -92,10 +84,6 @@ criteria = "safe-to-deploy" version = "0.8.8" criteria = "safe-to-deploy" -[[exemptions.ctor]] -version = "0.1.26" -criteria = "safe-to-run" - [[exemptions.dashmap]] version = "4.0.2" criteria = "safe-to-deploy" @@ -244,10 +232,6 @@ criteria = "safe-to-deploy" version = "1.0.10" criteria = "safe-to-deploy" -[[exemptions.pkg-config]] -version = "0.3.26" -criteria = "safe-to-deploy" - [[exemptions.plain]] version = "0.2.3" criteria = "safe-to-deploy" diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock index f38688a806..50b4241edb 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -10,6 +10,17 @@ Unsafe code, but its logic looks good to me. Necessary given what it is doing. Well tested, has quickchecks. """ +[[audits.bytecode-alliance.audits.camino]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +version = "1.1.4" + +[[audits.bytecode-alliance.audits.cargo-platform]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +version = "0.1.2" +notes = "no build, no ambient capabilities, no unsafe" + [[audits.bytecode-alliance.audits.cfg-if]] who = "Alex Crichton " criteria = "safe-to-deploy" @@ -59,6 +70,12 @@ a few `unsafe` blocks related to utf-8 validation which are locally verifiable as correct and otherwise this crate is good to go. """ +[[audits.bytecode-alliance.audits.pkg-config]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +version = "0.3.25" +notes = "This crate shells out to the pkg-config executable, but it appears to sanitize inputs reasonably." + [[audits.bytecode-alliance.audits.rustix]] who = "Dan Gohman " criteria = "safe-to-deploy" @@ -218,6 +235,11 @@ criteria = "safe-to-deploy" delta = "0.42.0 -> 0.42.1" notes = "This is a Windows API bindings library maintained by Microsoft themselves. The diff is just adding license files." +[[audits.chromeos.audits.ctor]] +who = "George Burgess IV " +criteria = "safe-to-run" +version = "0.1.26" + [[audits.chromeos.audits.textwrap]] who = "ChromeOS" criteria = "safe-to-run" @@ -351,6 +373,12 @@ version = "0.2.15" notes = "All code written or reviewed by Josh Stone." aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" +[[audits.mozilla.audits.pkg-config]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "0.3.25 -> 0.3.26" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + [[audits.mozilla.audits.proc-macro2]] who = "Nika Layzell " criteria = "safe-to-deploy" From c1f84158aa154925fbe529b56c2559aeb0e38740 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Wed, 10 May 2023 11:36:12 +0200 Subject: [PATCH 14/74] Wildcard-certify zeitstempel, a crate I own and maintain --- supply-chain/audits.toml | 8 ++++++++ supply-chain/config.toml | 4 ---- supply-chain/imports.lock | 7 +++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml index c3f959dea4..136ed60cfc 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml @@ -1,6 +1,14 @@ # cargo-vet audits file +[[wildcard-audits.zeitstempel]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +user-id = 48 +start = "2021-03-03" +end = "2024-05-10" +notes = "Maintained by me" + [[audits.crossbeam-channel]] who = "Jan-Erik Rediger " criteria = "safe-to-deploy" diff --git a/supply-chain/config.toml b/supply-chain/config.toml index ffa60db12a..45a4d12ba9 100644 --- a/supply-chain/config.toml +++ b/supply-chain/config.toml @@ -355,7 +355,3 @@ criteria = "safe-to-deploy" [[exemptions.xshell-venv]] version = "1.1.0" criteria = "safe-to-deploy" - -[[exemptions.zeitstempel]] -version = "0.1.1" -criteria = "safe-to-deploy" diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock index 50b4241edb..6edb69c954 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -1,6 +1,13 @@ # cargo-vet imports lock +[[publisher.zeitstempel]] +version = "0.1.1" +when = "2021-03-18" +user-id = 48 +user-login = "badboy" +user-name = "Jan-Erik Rediger" + [[audits.bytecode-alliance.audits.arrayref]] who = "Nick Fitzgerald " criteria = "safe-to-deploy" From cbc5af5f9caf4fcc4c54412f222a57e2e65ab3af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 11 May 2023 05:56:55 +0000 Subject: [PATCH 15/74] Bump mypy from 1.2.0 to 1.3.0 in /glean-core/python Bumps [mypy](https://github.com/python/mypy) from 1.2.0 to 1.3.0. - [Commits](https://github.com/python/mypy/compare/v1.2.0...v1.3.0) --- updated-dependencies: - dependency-name: mypy dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- glean-core/python/requirements_dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glean-core/python/requirements_dev.txt b/glean-core/python/requirements_dev.txt index 959497dd85..3545f8e18c 100644 --- a/glean-core/python/requirements_dev.txt +++ b/glean-core/python/requirements_dev.txt @@ -4,7 +4,7 @@ coverage==7.2.2; python_version > '3.6' flake8==6.0.0; python_version >= '3.8' flake8-bugbear==23.5.9; python_version >= '3.8' jsonschema==3.2.0 -mypy==1.2.0; python_version > '3.6' +mypy==1.3.0; python_version > '3.6' pdoc3==0.10.0 pip pytest-localserver==0.7.1 From 8ab9a53b69e5c61dfb7e26dd8467ea023c816962 Mon Sep 17 00:00:00 2001 From: Travis Long Date: Tue, 9 May 2023 14:06:00 -0500 Subject: [PATCH 16/74] Bug 1827452 - Skip running CI on the release branch Since we already run CI when merging this branch back to main, we can skip running it on the release branch --- .circleci/config.yml | 87 +++++++++++++++++++-------- taskcluster/ci/android-build/kind.yml | 3 + taskcluster/ci/module-build/kind.yml | 3 + taskcluster/ci/rust/kind.yml | 3 + 4 files changed, 70 insertions(+), 26 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 895e1ffbe1..4e0d556c1e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,6 +15,9 @@ definitions: ignore: /.*/ tags: only: /^v.*/ + - ci_filters: &ci-filters + branches: + ignore: release ########################################################################## # COMMANDS @@ -1082,21 +1085,33 @@ workflows: version: 2 lint: jobs: - - Lint YAML with yamllint - - License check - - Lint Rust with clippy - - Docs internal metrics check - - Lint Android with ktlint and detekt - - Lint Python - - Check vendored schema - - Check Rust formatting - - Check Swift formatting + - Lint YAML with yamllint: + filters: *ci-filters + - License check: + filters: *ci-filters + - Lint Rust with clippy: + filters: *ci-filters + - Docs internal metrics check: + filters: *ci-filters + - Lint Android with ktlint and detekt: + filters: *ci-filters + - Lint Python: + filters: *ci-filters + - Check vendored schema: + filters: *ci-filters + - Check Rust formatting: + filters: *ci-filters + - Check Swift formatting: + filters: *ci-filters ci: jobs: - - Rust tests - stable - - Rust tests - minimum version - - Android tests + - Rust tests - stable: + filters: *ci-filters + - Rust tests - minimum version: + filters: *ci-filters + - Android tests: + filters: *ci-filters # iOS jobs run only on main by default, see below for manual-approved jobs - iOS build and test: filters: @@ -1106,28 +1121,42 @@ workflows: filters: branches: only: main - - Python 3_6 tests - - Python 3_6 tests minimum dependencies - - Python 3_7 tests - - Python 3_8 tests - - Python 3_9 tests - - Python 3_9 tests minimum dependencies - - Python 3_9 on Alpine tests - - Python 3_10 tests - - Python Windows x86_64 tests - - Python Windows i686 tests + - Python 3_6 tests: + filters: *ci-filters + - Python 3_6 tests minimum dependencies: + filters: *ci-filters + - Python 3_7 tests: + filters: *ci-filters + - Python 3_8 tests: + filters: *ci-filters + - Python 3_9 tests: + filters: *ci-filters + - Python 3_9 tests minimum dependencies: + filters: *ci-filters + - Python 3_9 on Alpine tests: + filters: *ci-filters + - Python 3_10 tests: + filters: *ci-filters + - Python Windows x86_64 tests: + filters: *ci-filters + - Python Windows i686 tests: + filters: *ci-filters - Generate Rust documentation: requires: - docs-spellcheck + filters: *ci-filters - Generate Python documentation: requires: - Python 3_10 tests + filters: *ci-filters - docs-linkcheck: requires: - Generate Rust documentation - Generate Python documentation - - docs-spellcheck + filters: *ci-filters + - docs-spellcheck: + filters: *ci-filters - docs-deploy: requires: - docs-linkcheck @@ -1143,19 +1172,25 @@ workflows: type: approval filters: branches: - ignore: main + ignore: + - main + - release - iOS build and test: requires: - hold filters: branches: - ignore: main + ignore: + - main + - release - iOS integration test: requires: - hold filters: branches: - ignore: main + ignore: + - main + - release release: jobs: diff --git a/taskcluster/ci/android-build/kind.yml b/taskcluster/ci/android-build/kind.yml index 75bb206e7d..6904a2a4f0 100644 --- a/taskcluster/ci/android-build/kind.yml +++ b/taskcluster/ci/android-build/kind.yml @@ -40,3 +40,6 @@ tasks: - 'testDebugUnitTest' using: gradlew use-caches: true + extra: + excludeBranches: + - release diff --git a/taskcluster/ci/module-build/kind.yml b/taskcluster/ci/module-build/kind.yml index 6d33b7b7bd..38b36f9d13 100644 --- a/taskcluster/ci/module-build/kind.yml +++ b/taskcluster/ci/module-build/kind.yml @@ -37,3 +37,6 @@ task-defaults: - ':{module_name}:checkMavenArtifacts' using: gradlew use-caches: true + extra: + excludeBranches: + - release diff --git a/taskcluster/ci/rust/kind.yml b/taskcluster/ci/rust/kind.yml index e044d4c87a..b1301f0425 100644 --- a/taskcluster/ci/rust/kind.yml +++ b/taskcluster/ci/rust/kind.yml @@ -26,3 +26,6 @@ tasks: commands: - ['cargo', 'clippy', '--version'] - ['cargo', 'clippy', '--verbose', '--all', '--all-targets', '--all-features', '--', '-D', 'warnings'] + extra: + excludeBranches: + - release From 0b61a592c82a6de035f0f0edbd0ee6e503e1cb0f Mon Sep 17 00:00:00 2001 From: Travis Long Date: Tue, 9 May 2023 15:01:10 -0500 Subject: [PATCH 17/74] Bug 1829745 - Expose accumulate samples APIs for TimingDistribution This exposes `accumulate_samples` and `accumulate_raw_samples_nanos` in the TimingDistribution traits --- CHANGELOG.md | 3 ++ glean-core/src/traits/timing_distribution.rs | 35 ++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6b9b98f32..6e771c78a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ [Full changelog](https://github.com/mozilla/glean/compare/v52.7.0...main) +* Rust + * Timing distribution traits now expose `accumulate_samples` and `accumulate_raw_samples_nanos`. This is a breaking change for consumers that make use of the trait as they will need to implement the new functions ([Bug 1829745](https://bugzilla.mozilla.org/show_bug.cgi?id=1829745)) + # v52.7.0 (2023-05-10) [Full changelog](https://github.com/mozilla/glean/compare/v52.6.0...v52.7.0) diff --git a/glean-core/src/traits/timing_distribution.rs b/glean-core/src/traits/timing_distribution.rs index 650a433e3d..03083753c6 100644 --- a/glean-core/src/traits/timing_distribution.rs +++ b/glean-core/src/traits/timing_distribution.rs @@ -43,6 +43,41 @@ pub trait TimingDistribution { /// same timing distribution metric. fn cancel(&self, id: TimerId); + /// Accumulates the provided signed samples in the metric. + /// + /// This is required so that the platform-specific code can provide us with + /// 64 bit signed integers if no `u64` comparable type is available. This + /// will take care of filtering and reporting errors for any provided negative + /// sample. + /// + /// Please note that this assumes that the provided samples are already in + /// the "unit" declared by the instance of the metric type (e.g. if the + /// instance this method was called on is using [`crate::TimeUnit::Second`], then + /// `samples` are assumed to be in that unit). + /// + /// # Arguments + /// + /// * `samples` - The vector holding the samples to be recorded by the metric. + /// + /// ## Notes + /// + /// Discards any negative value in `samples` and report an [`ErrorType::InvalidValue`] + /// for each of them. Reports an [`ErrorType::InvalidOverflow`] error for samples that + /// are longer than `MAX_SAMPLE_TIME`. + fn accumulate_samples(&self, samples: Vec); + + /// Accumulates the provided samples in the metric. + /// + /// # Arguments + /// + /// * `samples` - A list of samples recorded by the metric. + /// Samples must be in nanoseconds. + /// ## Notes + /// + /// Reports an [`ErrorType::InvalidOverflow`] error for samples that + /// are longer than `MAX_SAMPLE_TIME`. + fn accumulate_raw_samples_nanos(&self, samples: Vec); + /// **Exported for test purposes.** /// /// Gets the currently stored value of the metric. From 00c477693e83eec0cfdc05452f814d3bc9f1db92 Mon Sep 17 00:00:00 2001 From: Beatriz Rizental Date: Wed, 10 May 2023 16:03:41 +0200 Subject: [PATCH 18/74] Proposal: Make Swift debug APIs public as well MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I forgot to ask for Swift changes on https://bugzilla.mozilla.org/show_bug.cgi?id=1830937. Can we get this change as well? 🥺 --- CHANGELOG.md | 2 ++ glean-core/ios/Glean/Glean.swift | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e771c78a3..025a87a7a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ * Rust * Timing distribution traits now expose `accumulate_samples` and `accumulate_raw_samples_nanos`. This is a breaking change for consumers that make use of the trait as they will need to implement the new functions ([Bug 1829745](https://bugzilla.mozilla.org/show_bug.cgi?id=1829745)) +* Swift + * Make debugging APIs available on Swift ([#2470](https://github.com/mozilla/glean/pull/2470)) # v52.7.0 (2023-05-10) diff --git a/glean-core/ios/Glean/Glean.swift b/glean-core/ios/Glean/Glean.swift index 7195ce7752..3f0736a964 100644 --- a/glean-core/ios/Glean/Glean.swift +++ b/glean-core/ios/Glean/Glean.swift @@ -328,7 +328,7 @@ public class Glean { /// /// - parameters: /// * value: The value of the tag, which must be a valid HTTP header value. - func setDebugViewTag(_ tag: String) -> Bool { + public func setDebugViewTag(_ tag: String) -> Bool { return gleanSetDebugViewTag(tag) } @@ -337,7 +337,7 @@ public class Glean { /// /// - parameters: /// * value: The value of the option. - func setLogPings(_ value: Bool) { + public func setLogPings(_ value: Bool) { gleanSetLogPings(value) } From 54bc9f2a0bd388ad5cd672fc88050e589aea3127 Mon Sep 17 00:00:00 2001 From: Bruno Rosa Date: Wed, 17 May 2023 13:27:53 -0400 Subject: [PATCH 19/74] Bug 1831181 - android multi-process doc updates Add a step to the docs to call `setDefaultMainProcess` to ensure pings are sent. --- docs/user/reference/general/initializing.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/user/reference/general/initializing.md b/docs/user/reference/general/initializing.md index cb458c7a7b..f932e0b33a 100644 --- a/docs/user/reference/general/initializing.md +++ b/docs/user/reference/general/initializing.md @@ -119,6 +119,7 @@ The Glean Kotlin SDK supports use across multiple processes. This is enabled by Requirements for a non-main process - `Glean.initialize` must be called with the `dataPath` value set in the `Glean.Configuration`. - The default `dataPath` for Glean is `{context.applicationInfo.dataDir}/glean_data`. If you try to use this path, `Glean.initialize` will fail and throw an error. +- [Set the default process name](https://developer.android.com/reference/androidx/work/Configuration.Builder#setDefaultProcessName(java.lang.String)) as your main process. If this is not set up correctly, pings from the non-main process will not send. `Configuration.Builder().setDefaultProcessName()` **Note**: When initializing from a non-main process with a specified `dataPath`, the lifecycle observers will not be set up. This means you will not receive otherwise scheduled [baseline](../../user/pings/baseline.md) or [metrics](../../user/pings/metrics.md) pings. From 2ee1c8f69982e8fddc020c06ab308a2a6c301b0d Mon Sep 17 00:00:00 2001 From: Travis Long Date: Thu, 18 May 2023 12:10:53 -0500 Subject: [PATCH 20/74] Bug 1826973 - Add Data Control Plane user documentation This adds documentation about the Glean Data Control Plane functionality (a.k.a. Server Knobs). --- .dictionary | 6 +- .../data-control-plane/advanced-topics.md | 137 ++++++++++++++++++ .../data-control-plane/example-scenarios.md | 40 +++++ .../experimenter-configuration.md | 21 +++ .../user/metrics/data-control-plane/faq.md | 9 ++ .../user/metrics/data-control-plane/index.md | 21 +++ .../data-control-plane/product-integration.md | 66 +++++++++ 7 files changed, 299 insertions(+), 1 deletion(-) create mode 100644 docs/user/user/metrics/data-control-plane/advanced-topics.md create mode 100644 docs/user/user/metrics/data-control-plane/example-scenarios.md create mode 100644 docs/user/user/metrics/data-control-plane/experimenter-configuration.md create mode 100644 docs/user/user/metrics/data-control-plane/faq.md create mode 100644 docs/user/user/metrics/data-control-plane/index.md create mode 100644 docs/user/user/metrics/data-control-plane/product-integration.md diff --git a/.dictionary b/.dictionary index bcd4220a2a..ef85f9f34c 100644 --- a/.dictionary +++ b/.dictionary @@ -1,4 +1,4 @@ -personal_ws-1.1 en 257 utf-8 +personal_ws-1.1 en 261 utf-8 AAR AARs ABI @@ -157,11 +157,13 @@ gradle grcov gzip gzipped +homescreen hotfix html illumos init inlined +instrumentations integrations io ios @@ -209,6 +211,7 @@ rethrow rfloor rkv rkv's +rollout rollouts runtime runtimes @@ -247,6 +250,7 @@ uniffi unminified uploader uploaders +urlbar vendored vendoring webextension diff --git a/docs/user/user/metrics/data-control-plane/advanced-topics.md b/docs/user/user/metrics/data-control-plane/advanced-topics.md new file mode 100644 index 0000000000..3ab5bb4f72 --- /dev/null +++ b/docs/user/user/metrics/data-control-plane/advanced-topics.md @@ -0,0 +1,137 @@ +# Advanced Topics + +## Merging of Configurations from Multiple Features + +Since each feature defined as a Nimbus Feature can independently provide a Glean configuration, these must be merged together into a cohesive configuration for the entire set of metrics collected by Glean. + +In order to accomplish this, Glean uses the same feature identifier used by Nimbus. Provide this id when calling the Glean API to set the configuration. + +This means that any existing configuration that is associated with a particular feature identifier will be overwritten if a new configuration is provided with the same identifier. + +Configurations from all identifiers will be merged together along with the default values in the metrics.yaml file and applied to the appropriate metrics. + +### Example + +Imagine a situation where we have 3 features (`A`, `B`, `C`). Each of these features has an event (`A.event`, `B.event`, `C.event`) and these events all default to disabled from their definition in the metrics.yaml file. + +Let’s walk through an example of changing configurations for these features that illustrates how the merging will work: + +#### _Initial State_ + +This is what the initial state of the events looks like with no configurations applied. All of the events are falling back to the defaults from the metrics.yaml file. This is the starting point for Scenario 1 in the [Example Scenarios]. + +- Feature A + - No config, default used + - A.event is disabled +- Feature B + - No config, default used + - B.event is disabled +- Feature C + - No config, default used + - C.event is disabled + +#### _Second State_ + +In this state, let’s create two rollouts which will provide configurations for features A and B that will enable the events associated with each. The first rollout selects Feature A in experimenter and provides the indicated configuration in the Branch setup page. The second rollout does the same thing, only for Feature B. + +- Feature A + - Configuration: + - ```json + { + // Other variable configs + + // Glean metric config + "gleanMetricConfiguration": { + "A.event": true + } + } + ``` + - A.event is enabled +- Feature B + - Configuration: + - ```json + { + // Other variable configs + + // Glean metric config + "gleanMetricConfiguration": { + "B.event": true + } + } + ``` + - B.event is enabled +- Feature C + - No config, default used + - C.event is disabled + +As you can see, the A.event and B.event are enabled by the configurations while C.event remains disabled because there is no rollout for it. + +#### _Third State_ + +In this state, let’s end the rollout for Feature B, start a rollout for Feature C, and launch an experiment for Feature A. Because experiments take precedence over rollouts, this should supersede our configuration from the rollout for Feature A. + +- Feature A + - Configuration: + - ```json + { + // Other variable configs + + // Glean metric config + "gleanMetricConfiguration": { + "A.event": false + } + } + ``` + - A.event is disabled +- Feature B + - No config, default used + - B.event is disabled +- Feature C + - Configuration: + - ```json + { + // Other variable configs + + // Glean metric config + "gleanMetricConfiguration": { + "C.event": true + } + } + ``` + - C.event is enabled + +After the new changes to the currently running rollouts and experiments, this client is now enrolled in the experiment for Feature A and the configuration is suppressing the A.event. Feature B is no longer sending B.event because it is reverting back to the defaults from the metrics.yaml file. And finally, Feature C is sending C.event with the rollout configuration applied. + +#### _Fourth State_ + +Finally, in this state, let’s end the rollout for Feature C along with the experiment for Feature A. This should stop the sending of the B.event and C.event and resume sending of the A.event as the rollout configuration will again be applied since the experiment configuration is no longer available. + +- Feature A + - Configuration + - ```json + { + // Other variable configs + + // Glean metric config + "gleanMetricConfiguration": { + "A.event": true + } + } + ``` + - A.event is enabled +- Feature B + - No config, default used + - B.event is disabled +- Feature C + - No config, default used + - C.event is disabled + +After the new changes to the currently running rollouts and experiments, this client is now enrolled in the experiment for Feature A and the configuration is suppressing the A.event. Feature B is no longer sending B.event because it is reverting back to the defaults from the metrics.yaml file. And finally, Feature C is sending C.event with the rollout configuration applied. + +In each case, Glean only updates the configuration associated with the feature that provided it. Nimbus’ feature exclusion would prevent a client from being enrolled in multiple rollouts or experiments for a given feature, so no more than one configuration would be applied per feature for a given client. + +### Merging Caveats + +Because there is currently nothing that ties a particular Nimbus Feature to a set of metrics, care must be taken to avoid feature overlap over a particular metric. If two different features supply conflicting configurations for the same metric identifier, then whether or not the metric is enabled will likely come down to a race condition of whoever set the configuration last + +[Example Scenarios]: example-scenarios.md diff --git a/docs/user/user/metrics/data-control-plane/example-scenarios.md b/docs/user/user/metrics/data-control-plane/example-scenarios.md new file mode 100644 index 0000000000..70b9d26848 --- /dev/null +++ b/docs/user/user/metrics/data-control-plane/example-scenarios.md @@ -0,0 +1,40 @@ +# Example Scenarios + +## Scenario 1 + +> *Landing a metric that is disabled by default and then enabling it for some segment of the population* + +This scenario can be expected in cases such as when instrumenting high-traffic areas of the browser. These are instrumentations that would normally generate a lot of data because they are recorded frequently for every user. + +In this case, the telemetry which has the potential to be high-volume would land with the “disabled” property of the metric set to “true”. This will ensure that it does not record data by default. + +An example metric definition with this property set would look something like this: + +```yaml +urlbar: + impression: + disabled: true + type: event + description: Recorded when urlbar results are shown to the user. + ... +``` + +Once the instrumentation is landed, it can now be enabled for a subset of the population through a Nimbus rollout or experiment without further code changes. + +Through [Nimbus], we have the ability to sample the population by setting the audience size to a certain percentage of the eligible population. Nimbus also provides the ability to target clients based on the available targeting parameters for a particular application (for instance, Firefox Desktop’s available targeting parameters). + +This can be used to slowly roll out instrumentations to the population in order to validate the data we are collecting before measuring the entire population and potentially avoiding costs and overhead by collecting data that isn’t useful. + +## Scenario 2 + +> *Landing a metric that is enabled by default and then disabling it for a segment of the population* + +This is effectively the inverse of [Scenario 1](#scenario-1), instead of landing the metrics disabled by default, they are landed as enabled so that they are normally collecting data from the entire population. + +Similar to the first scenario, a [Nimbus] rollout or experiment can then be launched to configure the metrics as disabled for a subset of the population. + +This provides a mechanism by which we can disable the sending of telemetry from an audience that we do not wish to collect telemetry data from. + +For instance, this could be useful in tuning out telemetry data coming from automation sources or bad actors. In addition, it provides a way to disable broken, incorrect, or unexpectedly noisy instrumentations as an operational safety mechanism to directly control the volume of the data we collect and ingest. + +[Nimbus]: https://experimenter.info diff --git a/docs/user/user/metrics/data-control-plane/experimenter-configuration.md b/docs/user/user/metrics/data-control-plane/experimenter-configuration.md new file mode 100644 index 0000000000..909d09a0bd --- /dev/null +++ b/docs/user/user/metrics/data-control-plane/experimenter-configuration.md @@ -0,0 +1,21 @@ +# Experimenter Configuration + +The structure of this configuration is a key-value collection with the full metric identification of the Glean metric serving as the key in the format . + +The values of the key-value pair are booleans which represent whether the metric is enabled (`true`) or not (`false`). + +In the example below `gleanMetricConfiguration` is the name of the variable defined in the Nimbus feature. + +This configuration would be what is entered into the branch configuration setup in Experimenter when defining an experiment or rollout. + +## Example Configuration: + +```json +{ + "gleanMetricConfiguration": { + "urlbar.abandonment": true, + "urlbar.engagement": true, + "urlbar.impression": true + } +} +``` diff --git a/docs/user/user/metrics/data-control-plane/faq.md b/docs/user/user/metrics/data-control-plane/faq.md new file mode 100644 index 0000000000..9f1e667899 --- /dev/null +++ b/docs/user/user/metrics/data-control-plane/faq.md @@ -0,0 +1,9 @@ +# Frequently Asked Questions + +* how can I tell if a given client id has the metric X on? + + + +* why isn't some client id reporting the metric that should be enabled for all the clients for that channel? (e.g. Some fraction of population may get stuck on “default” config) + + diff --git a/docs/user/user/metrics/data-control-plane/index.md b/docs/user/user/metrics/data-control-plane/index.md new file mode 100644 index 0000000000..7af09ab6ee --- /dev/null +++ b/docs/user/user/metrics/data-control-plane/index.md @@ -0,0 +1,21 @@ +# Data Control Plane (a.k.a. Server Knobs) + +Glean provides a Data [Control Plane] through which metrics can be enabled, disabled or throttled through a [Nimbus] rollout or experiment. + +Products can use this capability to control "data-traffic", similar to how a network control plane controls "network-traffic". + +This provides the ability to do the following: + +- Allow runtime changes to data collection without needing to land code and ride release trains. +- Eliminate the need for manual creation and maintenance of feature flags specific to data collection. +- Sampling of measurements from a subset of the population so that we do not collect or ingest more data than is necessary from high traffic areas of an application instrumented with Glean metrics. +- Operational safety through being able to react to high-volume or unwanted data. +- Visibility into sampling and sampling rates for remotely configured metrics. + +## Contents +- [Example Scenarios](example-scenarios.md) +- [Product Integration](product-integration.md) +- [Experimenter Configuration](experimenter-configuration.md) + +[Control Plane]: https://en.wikipedia.org/wiki/Control_plane +[Nimbus]: https://experimenter.info \ No newline at end of file diff --git a/docs/user/user/metrics/data-control-plane/product-integration.md b/docs/user/user/metrics/data-control-plane/product-integration.md new file mode 100644 index 0000000000..17e30ba951 --- /dev/null +++ b/docs/user/user/metrics/data-control-plane/product-integration.md @@ -0,0 +1,66 @@ +# Product Integration + +In order to enable sharing of this functionality between multiple Nimbus Features, the implementation is not defined as part of the stand-alone Glean feature defined in the Nimbus Feature Manifest, but instead is intended to be added as a feature variable to other Nimbus Feature definitions for them to make use of. + +## Desktop Feature Integration + +In order to make use of the remote metric configuration in a Firefox Desktop component, the component must first be defined as a Nimbus Feature. The instructions for defining your component as a feature (or multiple features) can be found in the Nimbus documentation specific to the [Nimbus Desktop Feature API]. Once you have defined a feature, you simply need to add a Feature Variable to represent the piece of the Glean configuration that will be provided by this Nimbus Feature. For example: + +```yaml +variables: + ... // Definitions of other feature variables + gleanMetricConfiguration: + type: json + description: >- + "Glean metric configuration" +``` + +This definition allows for configuration to be set in a Nimbus rollout or experiment and fetched by the client to be applied based on the enrollment. Once the Feature Variable has been defined, the final step is to fetch the configuration from Nimbus and supply it to the Glean API function along with the identifier for the feature. This can be done during initialization and again any time afterwards, such as in response to receiving an updated configuration from Nimbus. Only the latest configuration provided will be applied. An example call to set a configuration from the “urlbar” Nimbus Feature could look like this: + +```JavaScript +Services.fog.setMetricsFeatureConfig("urlbar", + JSON.stringify( + Lazy.NimbusFeatures.urlbar.getVariable("gleanMetricConfiguration") + ) +); +``` + +It is also recommended to register to listen for updates for the Nimbus Feature and apply new configurations as soon as possible. The following example illustrates how the “urlbar” Nimbus Feature might register and update the metric configuration: + +```JavaScript +lazy.NimbusFeatures.urlbar.onUpdate(() => { + let cfg = lazy.NimbusFeatures.glean.getVariable( + "gleanMetricConfiguration" + ); + Services.fog.setMetricsFeatureConfig("urlbar", JSON.stringify(cfg)); +}); +``` + +## Mobile Feature Integration + +In order to make use of the remote metric configuration in a Firefox Mobile application, you must first define a Nimbus Feature or add a variable to an existing Nimbus Feature. The instructions for defining your component as a feature (or multiple features) can be found in the Nimbus documentation specific to the Nimbus Mobile Feature API. Once you have defined a feature, you simply need to add a Feature Variable to represent the piece of the Glean configuration that will be provided by this Nimbus Feature. For example: + +```yaml +features: + homescreen: + description: | + The homescreen that the user goes to when they press home or new + tab. + variables: + ... // Other homescreen variables + gleanMetricConfiguration: + description: Glean metric configuration + type: String + default: "{}" +``` + +Once the Feature Variable has been defined, the final step is to fetch the configuration from Nimbus and supply it to the Glean API function along with the identifier for the feature. This can be done during initialization and again any time afterwards, such as in response to receiving an updated configuration from Nimbus. Only the latest configuration provided will be applied. An example call to set a configuration from the “homescreen” Nimbus Feature could look like this: + +```Swift +Glean.setMetricsEnabledConfig(FxNimbus.features.homescreen.value().metricsEnabled) +``` + +Since mobile experiments only update on initialization of the application, it isn't necessary to register to listen for notifications for experiment updates. + +[Nimbus]: https://experimenter.info +[Nimbus Desktop Feature API]: https://experimenter.info/desktop-feature-api \ No newline at end of file From cf87effcf1d3f24b6e7239d5a51957031b73664e Mon Sep 17 00:00:00 2001 From: Travis Long Date: Mon, 22 May 2023 07:31:07 -0500 Subject: [PATCH 21/74] Add Data Control Plane link to doc index [ci-skip] Also fixes some broken doc-links --- docs/user/SUMMARY.md | 7 +++- .../user/metrics/data-control-plane/index.md | 8 +++-- .../user/metrics/metrics-remote-settings.md | 35 ------------------- 3 files changed, 11 insertions(+), 39 deletions(-) delete mode 100644 docs/user/user/metrics/metrics-remote-settings.md diff --git a/docs/user/SUMMARY.md b/docs/user/SUMMARY.md index b7279f84f5..9bf72f0d2e 100644 --- a/docs/user/SUMMARY.md +++ b/docs/user/SUMMARY.md @@ -17,7 +17,12 @@ - [Validating metrics](user/metrics/validation-checklist.md) - [Error reporting](user/metrics/error-reporting.md) - [Metrics collected by the Glean SDKs](user/collected-metrics/metrics.md) - - [Enable and Disable metrics using Nimbus](user/metrics/metrics-remote-settings.md) + - [Data Control Plane (Remote Metric Configuration)](user/metrics/data-control-plane/index.md) + - [Example Scenarios](user/metrics/data-control-plane/example-scenarios.md) + - [Product Integration](user/metrics/data-control-plane/product-integration.md) + - [Experimenter Configuration](user/metrics/data-control-plane/experimenter-configuration.md) + - [Advanced Topics](user/metrics/data-control-plane/advanced-topics.md) + - [Frequently Asked Questions](user/metrics/data-control-plane/faq.md) - [Pings](user/pings/index.md) - [Adding new custom pings](user/pings/custom.md) - [Testing custom pings](user/pings/testing-custom-pings.md) diff --git a/docs/user/user/metrics/data-control-plane/index.md b/docs/user/user/metrics/data-control-plane/index.md index 7af09ab6ee..f7506f472e 100644 --- a/docs/user/user/metrics/data-control-plane/index.md +++ b/docs/user/user/metrics/data-control-plane/index.md @@ -13,9 +13,11 @@ This provides the ability to do the following: - Visibility into sampling and sampling rates for remotely configured metrics. ## Contents -- [Example Scenarios](example-scenarios.md) -- [Product Integration](product-integration.md) -- [Experimenter Configuration](experimenter-configuration.md) +- [Example Scenarios](./example-scenarios.md) +- [Product Integration](./product-integration.md) +- [Experimenter Configuration](./experimenter-configuration.md) +- [Advanced Topics](./advanced-topics.md) +- [Frequently Asked Questions](./faq.md) [Control Plane]: https://en.wikipedia.org/wiki/Control_plane [Nimbus]: https://experimenter.info \ No newline at end of file diff --git a/docs/user/user/metrics/metrics-remote-settings.md b/docs/user/user/metrics/metrics-remote-settings.md deleted file mode 100644 index 0953ec1698..0000000000 --- a/docs/user/user/metrics/metrics-remote-settings.md +++ /dev/null @@ -1,35 +0,0 @@ -# Remote Configuration of Metrics - -## Overview - -> **Important:** This functionality is experimental and is not ready for production use without coordination with the Glean Team. - -Glean metrics have the ability to be disabled and enabled at runtime, effectively overriding the `disabled` property of the metric defined for it in the `metrics.yaml` file. This functionality is currently able to be controlled through [Nimbus experiments and rollouts](https://experimenter.info). - -Having metrics which can be remotely turned on and off via remote settings allows us to precisely control the sample of the population sending us telemetry. -Through this, event metrics can be instrumented in areas of high activity and only a subset of the population can be sampled to reduce the amount of traffic and data storage needed while still maintaining enough of a signal from the telemetry to make data-informed decisions based on it. - - -## How to Enable/Disable Metrics - -The instructions and requirements for running Nimbus experiments and rollouts can be found at https://experimenter.info. The purpose of the instructions found here in the Glean Book are meant to supplement the Nimbus information and aid in running experiments that interact with Glean metrics. - -When creating an experiment definition in the Experimenter UI, during the Branches Configuration stage: - -- Be sure to select `Glean` as the feature from the dropdown. If you do not see `Glean` as an option, then it has not been enabled for your application yet. -- Ensure that the feature is enabled is toggled to "On" in the Branch Configuration page for each branch. -- To disable remote configuration of metrics for a branch, enter empty braces into the "value" field: `{}`. -- To enable a remote configuration for a branch, enter JSON into the "Value" field in the following format: - - ```JSON - { - "metricsDisabled": { - "category.name": true, - "category.different_name": false, - ... - } - } - ``` - - Do not change `"metricsDisabled"`, this is the required object key for Nimbus to recognize the Glean feature. - - Do change `"category.name"` to match the category and name of the metric to disable/enable. - - This is a list you can add as many entries in the format as needed. - - Since this controls the `disabled` property of the metrics, `true` tells Glean to *_disable_* the metric, while `false` would tell Glean to *_enable_* the metric. From 212b231d70ec61f0b7e4d819f6b330cd5d689309 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Mon, 22 May 2023 19:37:08 -0400 Subject: [PATCH 22/74] Update snakeyaml to version 2.0 --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 3c450a87f5..555f813b12 100644 --- a/settings.gradle +++ b/settings.gradle @@ -5,7 +5,7 @@ import org.yaml.snakeyaml.Yaml buildscript { dependencies { - classpath 'org.yaml:snakeyaml:1.23' + classpath 'org.yaml:snakeyaml:2.0' } repositories { mavenCentral() From 58961af6da70fd323ba162731fb67568dd1c9900 Mon Sep 17 00:00:00 2001 From: Travis Long Date: Thu, 18 May 2023 14:34:38 -0500 Subject: [PATCH 23/74] Bug 1832324 - Add a way to flush and await pings in iOS --- .dictionary | 3 +- CHANGELOG.md | 1 + glean-core/ios/Glean/Glean.swift | 5 ++ glean-core/ios/GleanTests/GleanTests.swift | 60 ++++++++++++++++++++++ glean-core/src/glean.udl | 3 ++ glean-core/src/lib.rs | 5 ++ 6 files changed, 76 insertions(+), 1 deletion(-) diff --git a/.dictionary b/.dictionary index ef85f9f34c..9d68d4e50d 100644 --- a/.dictionary +++ b/.dictionary @@ -1,4 +1,4 @@ -personal_ws-1.1 en 261 utf-8 +personal_ws-1.1 en 262 utf-8 AAR AARs ABI @@ -92,6 +92,7 @@ Unbreak Underflowing UniFFI Uploaders +VPN Wasm WebRender Webpack diff --git a/CHANGELOG.md b/CHANGELOG.md index 025a87a7a9..ea07dd983a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Timing distribution traits now expose `accumulate_samples` and `accumulate_raw_samples_nanos`. This is a breaking change for consumers that make use of the trait as they will need to implement the new functions ([Bug 1829745](https://bugzilla.mozilla.org/show_bug.cgi?id=1829745)) * Swift * Make debugging APIs available on Swift ([#2470](https://github.com/mozilla/glean/pull/2470)) + * Added a shutdown API for Swift. This should only be necessary for when Glean is running in a process other than the main process (like in the VPN daemon, for instance)([Bug 1832324](https://bugzilla.mozilla.org/show_bug.cgi?id=1832324)) # v52.7.0 (2023-05-10) diff --git a/glean-core/ios/Glean/Glean.swift b/glean-core/ios/Glean/Glean.swift index 3f0736a964..56a91d3b7a 100644 --- a/glean-core/ios/Glean/Glean.swift +++ b/glean-core/ios/Glean/Glean.swift @@ -394,6 +394,11 @@ public class Glean { gleanSetMetricsEnabledConfig(json) } + /// Shuts down Glean in an orderly fashion + public func shutdown() { + gleanShutdown() + } + /// When applications are launched using the custom URL scheme, this helper function will process /// the URL and parse the debug commands /// diff --git a/glean-core/ios/GleanTests/GleanTests.swift b/glean-core/ios/GleanTests/GleanTests.swift index c075eed633..d490952d69 100644 --- a/glean-core/ios/GleanTests/GleanTests.swift +++ b/glean-core/ios/GleanTests/GleanTests.swift @@ -9,6 +9,7 @@ import XCTest private typealias GleanInternalMetrics = GleanMetrics.GleanInternalMetrics +// swiftlint:disable type_body_length class GleanTests: XCTestCase { var expectation: XCTestExpectation? @@ -367,4 +368,63 @@ class GleanTests: XCTestCase { Glean.shared.initialize(uploadEnabled: true, buildInfo: stubBuildInfo()) XCTAssertFalse(Glean.shared.isCustomDataPath) } + + func testShutdown() { + // This test relies on Glean not being initialized + Glean.shared.testDestroyGleanHandle() + + // We expect 10 pings later + stubServerReceive { pingType, _ in + if pingType == "baseline" { + // Ignore initial "active" baseline ping + return + } + + XCTAssertEqual("custom", pingType) + + // Fulfill test's expectation once we parsed the incoming data. + DispatchQueue.main.async { + // Let the response get processed before we mark the expectation fulfilled + self.expectation?.fulfill() + } + } + + let customPing = Ping( + name: "custom", + includeClientId: true, + sendIfEmpty: false, + reasonCodes: [] + ) + + let counter = CounterMetricType(CommonMetricData( + category: "telemetry", + name: "counter_metric", + sendInPings: ["custom"], + lifetime: .application, + disabled: false + )) + + expectation = expectation(description: "Completed upload") + expectation?.expectedFulfillmentCount = 10 + + // Set the last time the "metrics" ping was sent to now. This is required for us to not + // send a metrics pings the first time we initialize Glean and to keep it from interfering + // with these tests. + let now = Date() + MetricsPingScheduler(true).updateSentDate(now) + // Restart glean + Glean.shared.resetGlean(clearStores: false) + + // Set data and try to submit a custom ping 10x. + for _ in (0..<10) { + counter.add(1) + customPing.submit() + } + + Glean.shared.shutdown() + waitForExpectations(timeout: 5.0) { error in + XCTAssertNil(error, "Test timed out waiting for upload: \(error!)") + } + } } +// swiftlint:enable type_body_length diff --git a/glean-core/src/glean.udl b/glean-core/src/glean.udl index 67466b4640..2b62a8f102 100644 --- a/glean-core/src/glean.udl +++ b/glean-core/src/glean.udl @@ -13,6 +13,9 @@ namespace glean { // It will return immediately. void glean_initialize(InternalConfiguration cfg, ClientInfoMetrics client_info, OnGleanEvents callbacks); + /// Shuts down Glean in an orderly fashion. + void glean_shutdown(); + // Creates and initializes a new Glean object for use in a subprocess. // // Importantly, this will not send any pings at startup, since that diff --git a/glean-core/src/lib.rs b/glean-core/src/lib.rs index 7d6ea2f179..71e100252f 100644 --- a/glean-core/src/lib.rs +++ b/glean-core/src/lib.rs @@ -274,6 +274,11 @@ pub fn glean_initialize( initialize_inner(cfg, client_info, callbacks); } +/// Shuts down Glean in an orderly fashion. +pub fn glean_shutdown() { + shutdown(); +} + /// Creates and initializes a new Glean object for use in a subprocess. /// /// Importantly, this will not send any pings at startup, since that From adf27f953db92902970ab1b57e365985e4676256 Mon Sep 17 00:00:00 2001 From: Travis Long Date: Wed, 24 May 2023 07:09:01 -0500 Subject: [PATCH 24/74] Bug 1833381 - Add capability to merge remote metric configs --- CHANGELOG.md | 2 ++ glean-core/src/core/mod.rs | 6 ++-- glean-core/src/lib_unit_tests.rs | 47 ++++++++++++++++++++++++++++---- 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea07dd983a..c280d89380 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ [Full changelog](https://github.com/mozilla/glean/compare/v52.7.0...main) +* General + * Adds the capability to merge remote metric configurations, enabling multiple Nimbus Features or components to share this functionality ([Bug 1833381](https://bugzilla.mozilla.org/show_bug.cgi?id=1833381)) * Rust * Timing distribution traits now expose `accumulate_samples` and `accumulate_raw_samples_nanos`. This is a breaking change for consumers that make use of the trait as they will need to implement the new functions ([Bug 1829745](https://bugzilla.mozilla.org/show_bug.cgi?id=1829745)) * Swift diff --git a/glean-core/src/core/mod.rs b/glean-core/src/core/mod.rs index 29ee1e52c7..e83d8f4f82 100644 --- a/glean-core/src/core/mod.rs +++ b/glean-core/src/core/mod.rs @@ -714,8 +714,10 @@ impl Glean { pub fn set_metrics_enabled_config(&self, cfg: MetricsEnabledConfig) { // Set the current MetricsEnabledConfig, keeping the lock until the epoch is // updated to prevent against reading a "new" config but an "old" epoch - let mut lock = self.remote_settings_metrics_config.lock().unwrap(); - *lock = cfg; + let mut metric_config = self.remote_settings_metrics_config.lock().unwrap(); + + // Merge the exising configuration with the supplied one + metric_config.metrics_enabled.extend(cfg.metrics_enabled); // Update remote_settings epoch self.remote_settings_epoch.fetch_add(1, Ordering::SeqCst); diff --git a/glean-core/src/lib_unit_tests.rs b/glean-core/src/lib_unit_tests.rs index 6d67f6ab93..6a8bf4258c 100644 --- a/glean-core/src/lib_unit_tests.rs +++ b/glean-core/src/lib_unit_tests.rs @@ -816,7 +816,7 @@ fn test_setting_log_pings() { } #[test] -fn test_set_metrics_disabled() { +fn test_set_remote_metric_configuration() { let (glean, _t) = new_glean(None); let metric = StringMetric::new(CommonMetricData { category: "category".to_string(), @@ -882,13 +882,19 @@ fn test_set_metrics_disabled() { "Shouldn't set when disabled" ); - // 4. Set a new configuration where the metrics are enabled - metrics_enabled_config = json!({}).to_string(); + // 4. Set a new configuration where one metric is enabled + metrics_enabled_config = json!( + { + "category.string_metric": true, + } + ) + .to_string(); glean.set_metrics_enabled_config( MetricsEnabledConfig::try_from(metrics_enabled_config).unwrap(), ); - // 5. Since the metrics are now enabled, setting a new value should work + // 5. Since the first metric is enabled, setting a new value should work + // on it but not the second metric metric.set_sync(&glean, "VALUE_AFTER_REENABLED"); assert_eq!( "VALUE_AFTER_REENABLED", @@ -899,7 +905,38 @@ fn test_set_metrics_disabled() { .get("label1") .set_sync(&glean, "VALUE_AFTER_REENABLED"); assert_eq!( - "VALUE_AFTER_REENABLED", + "TEST_VALUE", + another_metric + .get("label1") + .get_value(&glean, "baseline") + .unwrap(), + "Should not set if metric config entry unchanged" + ); + + // 6. Set a new configuration where the second metric is enabled. This + // should be merged with the existing configuration and then both + // metrics should be enabled at that point. + metrics_enabled_config = json!( + { + "category.labeled_string_metric": true, + } + ) + .to_string(); + glean.set_metrics_enabled_config( + MetricsEnabledConfig::try_from(metrics_enabled_config).unwrap(), + ); + + // 7. Now both metrics are enabled, setting a new value should work for + // both metrics with the merged configurations + metric.set_sync(&glean, "FINAL VALUE"); + assert_eq!( + "FINAL VALUE", + metric.get_value(&glean, "baseline").unwrap(), + "Should set when still enabled" + ); + another_metric.get("label1").set_sync(&glean, "FINAL VALUE"); + assert_eq!( + "FINAL VALUE", another_metric .get("label1") .get_value(&glean, "baseline") From a75daa5d6e78faf5c89282124b6176ebae9d9242 Mon Sep 17 00:00:00 2001 From: Travis Long Date: Wed, 24 May 2023 08:41:25 -0500 Subject: [PATCH 25/74] Update user documentation --- .../metrics/data-control-plane/advanced-topics.md | 8 ++------ docs/user/user/metrics/data-control-plane/faq.md | 8 ++++---- .../data-control-plane/product-integration.md | 15 +++++++-------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/docs/user/user/metrics/data-control-plane/advanced-topics.md b/docs/user/user/metrics/data-control-plane/advanced-topics.md index 3ab5bb4f72..e856332096 100644 --- a/docs/user/user/metrics/data-control-plane/advanced-topics.md +++ b/docs/user/user/metrics/data-control-plane/advanced-topics.md @@ -4,11 +4,7 @@ Since each feature defined as a Nimbus Feature can independently provide a Glean configuration, these must be merged together into a cohesive configuration for the entire set of metrics collected by Glean. -In order to accomplish this, Glean uses the same feature identifier used by Nimbus. Provide this id when calling the Glean API to set the configuration. - -This means that any existing configuration that is associated with a particular feature identifier will be overwritten if a new configuration is provided with the same identifier. - -Configurations from all identifiers will be merged together along with the default values in the metrics.yaml file and applied to the appropriate metrics. +Configurations will be merged together along with the default values in the metrics.yaml file and applied to the appropriate metrics. Only the latest configuration provided for a given metric will be applied and any previously configured metrics that are omitted from the new configuration will not be changed. ### Example @@ -132,6 +128,6 @@ In each case, Glean only updates the configuration associated with the feature t ### Merging Caveats -Because there is currently nothing that ties a particular Nimbus Feature to a set of metrics, care must be taken to avoid feature overlap over a particular metric. If two different features supply conflicting configurations for the same metric identifier, then whether or not the metric is enabled will likely come down to a race condition of whoever set the configuration last +Because there is currently nothing that ties a particular Nimbus Feature to a set of metrics, care must be taken to avoid feature overlap over a particular metric. If two different features supply conflicting configurations for the same metric, then whether or not the metric is enabled will likely come down to a race condition of whoever set the configuration last. [Example Scenarios]: example-scenarios.md diff --git a/docs/user/user/metrics/data-control-plane/faq.md b/docs/user/user/metrics/data-control-plane/faq.md index 9f1e667899..65f50d1457 100644 --- a/docs/user/user/metrics/data-control-plane/faq.md +++ b/docs/user/user/metrics/data-control-plane/faq.md @@ -1,9 +1,9 @@ # Frequently Asked Questions -* how can I tell if a given client id has the metric X on? +* How can I tell if a given client id has the metric X on? +Once we have established the functionality behind the data control plane, a dashboard for monitoring this will be provided. Details are to be determined. +* Why isn't some client id reporting the metric that should be enabled for all the clients for that channel? (e.g. Some fraction of population may get stuck on “default” config) -* why isn't some client id reporting the metric that should be enabled for all the clients for that channel? (e.g. Some fraction of population may get stuck on “default” config) - - +Nimbus must be able to both reach and supply a valid configuration to the audience. For some outliers this doesn't work and so may be "unreachable" at times. diff --git a/docs/user/user/metrics/data-control-plane/product-integration.md b/docs/user/user/metrics/data-control-plane/product-integration.md index 17e30ba951..e7c88a99ee 100644 --- a/docs/user/user/metrics/data-control-plane/product-integration.md +++ b/docs/user/user/metrics/data-control-plane/product-integration.md @@ -15,24 +15,23 @@ variables: "Glean metric configuration" ``` -This definition allows for configuration to be set in a Nimbus rollout or experiment and fetched by the client to be applied based on the enrollment. Once the Feature Variable has been defined, the final step is to fetch the configuration from Nimbus and supply it to the Glean API function along with the identifier for the feature. This can be done during initialization and again any time afterwards, such as in response to receiving an updated configuration from Nimbus. Only the latest configuration provided will be applied. An example call to set a configuration from the “urlbar” Nimbus Feature could look like this: +This definition allows for configuration to be set in a Nimbus rollout or experiment and fetched by the client to be applied based on the enrollment. Once the Feature Variable has been defined, the final step is to fetch the configuration from Nimbus and supply it to the Glean API. This can be done during initialization and again any time afterwards, such as in response to receiving an updated configuration from Nimbus. Only the latest configuration provided will be applied and any previously configured metrics that are omitted from the new configuration will not be changed. An example call to set a configuration from the “urlbar” Nimbus Feature could look like this: ```JavaScript -Services.fog.setMetricsFeatureConfig("urlbar", - JSON.stringify( - Lazy.NimbusFeatures.urlbar.getVariable("gleanMetricConfiguration") - ) +let cfg = lazy.NimbusFeatures.urlbar.getVariable( + "gleanMetricConfiguration" ); +Services.fog.setMetricsFeatureConfig(JSON.stringify(cfg)); ``` It is also recommended to register to listen for updates for the Nimbus Feature and apply new configurations as soon as possible. The following example illustrates how the “urlbar” Nimbus Feature might register and update the metric configuration: ```JavaScript lazy.NimbusFeatures.urlbar.onUpdate(() => { - let cfg = lazy.NimbusFeatures.glean.getVariable( + let cfg = lazy.NimbusFeatures.urlbar.getVariable( "gleanMetricConfiguration" ); - Services.fog.setMetricsFeatureConfig("urlbar", JSON.stringify(cfg)); + Services.fog.setMetricsFeatureConfig(JSON.stringify(cfg)); }); ``` @@ -54,7 +53,7 @@ features: default: "{}" ``` -Once the Feature Variable has been defined, the final step is to fetch the configuration from Nimbus and supply it to the Glean API function along with the identifier for the feature. This can be done during initialization and again any time afterwards, such as in response to receiving an updated configuration from Nimbus. Only the latest configuration provided will be applied. An example call to set a configuration from the “homescreen” Nimbus Feature could look like this: +Once the Feature Variable has been defined, the final step is to fetch the configuration from Nimbus and supply it to the Glean API. This can be done during initialization and again any time afterwards, such as in response to receiving an updated configuration from Nimbus. Only the latest configuration provided will be applied and any previously configured metrics that are omitted from the new configuration will not be changed. An example call to set a configuration from the “homescreen” Nimbus Feature could look like this: ```Swift Glean.setMetricsEnabledConfig(FxNimbus.features.homescreen.value().metricsEnabled) From cfcd156449d2e40968a571ac27b6a1bae74c4004 Mon Sep 17 00:00:00 2001 From: Travis Long Date: Thu, 25 May 2023 08:28:57 -0500 Subject: [PATCH 26/74] Bug 1833870 - Increase StringList metric type limits --- .dictionary | 3 ++- CHANGELOG.md | 1 + docs/user/reference/metrics/string_list.md | 8 ++++---- .../glean/private/StringListMetricTypeTest.kt | 4 ++-- .../GleanTests/Metrics/StringListMetricTests.swift | 4 ++-- .../python/tests/metrics/test_string_list.py | 4 ++-- glean-core/src/metrics/string_list.rs | 4 ++-- glean-core/tests/string_list.rs | 14 +++++++------- 8 files changed, 22 insertions(+), 20 deletions(-) diff --git a/.dictionary b/.dictionary index 9d68d4e50d..2388c8b9b3 100644 --- a/.dictionary +++ b/.dictionary @@ -1,4 +1,4 @@ -personal_ws-1.1 en 262 utf-8 +personal_ws-1.1 en 263 utf-8 AAR AARs ABI @@ -76,6 +76,7 @@ SDKs SRE Solaris Sourcegraph +StringList TLDs TODO TSan diff --git a/CHANGELOG.md b/CHANGELOG.md index c280d89380..8cba9a561e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * General * Adds the capability to merge remote metric configurations, enabling multiple Nimbus Features or components to share this functionality ([Bug 1833381](https://bugzilla.mozilla.org/show_bug.cgi?id=1833381)) + * StringList metric type limits have been increased. The length of strings allowed has been increased from 50 to 100 to match the String metric type, and the list length has been increased from 20 to 100 ([Bug 1833870](https://bugzilla.mozilla.org/show_bug.cgi?id=1833870)) * Rust * Timing distribution traits now expose `accumulate_samples` and `accumulate_raw_samples_nanos`. This is a breaking change for consumers that make use of the trait as they will need to implement the new functions ([Bug 1829745](https://bugzilla.mozilla.org/show_bug.cgi?id=1829745)) * Swift diff --git a/docs/user/reference/metrics/string_list.md b/docs/user/reference/metrics/string_list.md index 671583147e..44fcb51733 100644 --- a/docs/user/reference/metrics/string_list.md +++ b/docs/user/reference/metrics/string_list.md @@ -101,8 +101,8 @@ Glean.search.engines.add("duck duck go"); #### Limits -* Fixed maximum string length: 50. Longer strings are truncated. This is measured in the number of bytes when the string is encoded in UTF-8. -* Fixed maximum list length: 20 items. Additional strings are dropped. +* Fixed maximum string length: 100. Longer strings are truncated. This is measured in the number of bytes when the string is encoded in UTF-8. +* Fixed maximum list length: 100 items. Additional strings are dropped. ### `set` @@ -188,8 +188,8 @@ Glean.search.engines.set(["wikipedia", "duck duck go"]); #### Limits -* Fixed maximum string length: 50. Longer strings are truncated. This is measured in the number of bytes when the string is encoded in UTF-8. -* Fixed maximum list length: 20 items. Additional strings are dropped. +* Fixed maximum string length: 100. Longer strings are truncated. This is measured in the number of bytes when the string is encoded in UTF-8. +* Fixed maximum list length: 100 items. Additional strings are dropped. ## Testing API diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/StringListMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/StringListMetricTypeTest.kt index caf08b9c88..9aa9fe4d59 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/StringListMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/StringListMetricTypeTest.kt @@ -188,12 +188,12 @@ class StringListMetricTypeTest { ) ) - for (x in 0..20) { + for (x in 0..100) { stringListMetric.add("value$x") } val snapshot = stringListMetric.testGetValue("store1")!! - assertEquals(20, snapshot.size) + assertEquals(100, snapshot.size) assertEquals(1, stringListMetric.testGetNumRecordedErrors(ErrorType.INVALID_VALUE)) } diff --git a/glean-core/ios/GleanTests/Metrics/StringListMetricTests.swift b/glean-core/ios/GleanTests/Metrics/StringListMetricTests.swift index 959f17b198..f37df075c5 100644 --- a/glean-core/ios/GleanTests/Metrics/StringListMetricTests.swift +++ b/glean-core/ios/GleanTests/Metrics/StringListMetricTests.swift @@ -141,11 +141,11 @@ class StringListMetricTests: XCTestCase { disabled: false )) - for n in 0 ... 20 { + for n in 0 ... 100 { stringListMetric.add(String(format: "value%02d", n)) } - XCTAssertEqual(20, stringListMetric.testGetValue()!.count) + XCTAssertEqual(100, stringListMetric.testGetValue()!.count) XCTAssertEqual(1, stringListMetric.testGetNumRecordedErrors(.invalidValue)) } } diff --git a/glean-core/python/tests/metrics/test_string_list.py b/glean-core/python/tests/metrics/test_string_list.py index 0ed65e1ca5..1309100cc0 100644 --- a/glean-core/python/tests/metrics/test_string_list.py +++ b/glean-core/python/tests/metrics/test_string_list.py @@ -128,10 +128,10 @@ def test_long_string_lists_are_truncated(): ) ) - for i in range(21): + for i in range(101): metric.add(f"value{i}") snapshot = metric.test_get_value() - assert 20 == len(snapshot) + assert 100 == len(snapshot) assert 1 == metric.test_get_num_recorded_errors(testing.ErrorType.INVALID_VALUE) diff --git a/glean-core/src/metrics/string_list.rs b/glean-core/src/metrics/string_list.rs index ab8657d3a5..75b2df7f80 100644 --- a/glean-core/src/metrics/string_list.rs +++ b/glean-core/src/metrics/string_list.rs @@ -14,9 +14,9 @@ use crate::CommonMetricData; use crate::Glean; // Maximum length of any list -const MAX_LIST_LENGTH: usize = 20; +const MAX_LIST_LENGTH: usize = 100; // Maximum length of any string in the list -const MAX_STRING_LENGTH: usize = 50; +const MAX_STRING_LENGTH: usize = 100; /// A string list metric. /// diff --git a/glean-core/tests/string_list.rs b/glean-core/tests/string_list.rs index 8e1589e8a9..7dd5acfbb5 100644 --- a/glean-core/tests/string_list.rs +++ b/glean-core/tests/string_list.rs @@ -121,7 +121,7 @@ fn long_string_values_are_truncated() { // Ensure the string was truncated to the proper length. assert_eq!( - vec![test_string[..50].to_string()], + vec![test_string[..100].to_string()], metric.get_value(&glean, "store1").unwrap() ); @@ -135,7 +135,7 @@ fn long_string_values_are_truncated() { // Ensure the string was truncated to the proper length. assert_eq!( - vec![test_string[..50].to_string()], + vec![test_string[..100].to_string()], metric.get_value(&glean, "store1").unwrap() ); @@ -186,18 +186,18 @@ fn string_lists_dont_exceed_max_items() { ..Default::default() }); - for _n in 1..21 { + for _n in 1..101 { metric.add_sync(&glean, "test_string"); } let expected: Vec = "test_string " - .repeat(20) + .repeat(100) .split_whitespace() .map(|s| s.to_string()) .collect(); assert_eq!(expected, metric.get_value(&glean, "store1").unwrap()); - // Ensure the 21st string wasn't added. + // Ensure the 101st string wasn't added. metric.add_sync(&glean, "test_string"); assert_eq!(expected, metric.get_value(&glean, "store1").unwrap()); @@ -207,9 +207,9 @@ fn string_lists_dont_exceed_max_items() { test_get_num_recorded_errors(&glean, metric.meta(), ErrorType::InvalidValue) ); - // Try to set it to a list that's too long. Ensure it cuts off at 20 elements. + // Try to set it to a list that's too long. Ensure it cuts off at 100 elements. let too_many: Vec = "test_string " - .repeat(21) + .repeat(101) .split_whitespace() .map(|s| s.to_string()) .collect(); From 87d02c604b75b9de2cc85ac230c474114e883377 Mon Sep 17 00:00:00 2001 From: Travis Long Date: Thu, 25 May 2023 12:31:56 -0500 Subject: [PATCH 27/74] Update twig.md --- .dictionary | 3 ++- docs/user/appendix/twig.md | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.dictionary b/.dictionary index 2388c8b9b3..b7bb4ceb2f 100644 --- a/.dictionary +++ b/.dictionary @@ -1,4 +1,4 @@ -personal_ws-1.1 en 263 utf-8 +personal_ws-1.1 en 264 utf-8 AAR AARs ABI @@ -26,6 +26,7 @@ Droettboom FOG FTE Fenix +Fournier Frictionless Fritzsche Funday diff --git a/docs/user/appendix/twig.md b/docs/user/appendix/twig.md index 8dc831b2e3..5321fefabe 100644 --- a/docs/user/appendix/twig.md +++ b/docs/user/appendix/twig.md @@ -66,3 +66,4 @@ They could be release notes, documentation, hopes, dreams, or whatever: so long * 2022-02-16: [What If I Want To Collect All The Data?](https://blog.mozilla.org/data/2022/02/16/this-week-in-glean-what-if-i-want-to-collect-all-the-data/) * 2022-02-25: [Your personal Glean data pipeline](https://blog.mozilla.org/data/2022/02/25/this-week-in-glean-your-personal-glean-data-pipeline/) * 2022-10-27: [Page Load Data, Three Ways (Or, How Expensive Are Events?)](https://blog.mozilla.org/data/2022/10/27/this-week-in-glean-page-load-data-three-ways-or-how-expensive-are-events/) +* 2023-05-25: [Reading “The Manager’s Path” by Camille Fournier](https://blog.mozilla.org/data/2023/05/25/this-week-in-data-reading-the-managers-path-by-camille-fournier/) From 94055a68596be3a73ec5e3117eeb3fa2160aa9bc Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Mon, 29 May 2023 03:04:37 -0400 Subject: [PATCH 28/74] Update tooltool.py to the latest upstream version (#2484) --- taskcluster/docker/linux/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/taskcluster/docker/linux/Dockerfile b/taskcluster/docker/linux/Dockerfile index 62cd2c332d..fd5d5ee2d9 100644 --- a/taskcluster/docker/linux/Dockerfile +++ b/taskcluster/docker/linux/Dockerfile @@ -63,8 +63,6 @@ RUN apt-get update -qq \ # . g++ \ libxml2-dev \ - # Python 2 for tooltool - python \ python3 \ python3-pip \ python3-venv \ @@ -122,7 +120,7 @@ RUN chown -R worker:worker /builds/worker/android-sdk RUN \ curl -sfSL --retry 5 --retry-delay 10 \ -o /usr/local/bin/tooltool.py \ - https://raw.githubusercontent.com/mozilla/build-tooltool/36511dae0ead6848017e2d569b1f6f1b36984d40/tooltool.py && \ + https://raw.githubusercontent.com/mozilla-releng/tooltool/master/client/tooltool.py && \ chmod +x /usr/local/bin/tooltool.py # %include-run-task From 8fe2a306c2ee54c53d458c49b9b1826269d3c208 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Tue, 1 Nov 2022 16:39:02 +0100 Subject: [PATCH 29/74] Upgrade to Xcode 14.3 This is essentially a revert of the revert-commit f941d76 again, adopting it to the latest release. Installed software: https://circle-macos-docs.s3.amazonaws.com/image-manifest/v12131/manifest.txt --- .circleci/config.yml | 30 +++++++++++++++--------------- .circleci/jazzy.yml | 2 +- CHANGELOG.md | 3 ++- bin/run-ios-build.sh | 2 +- bin/run-ios-sample-app-build.sh | 2 +- bin/run-ios-sample-app-test.sh | 2 +- bin/run-ios-tests.sh | 2 +- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4e0d556c1e..bcfc8f8504 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -481,7 +481,7 @@ jobs: Check Swift formatting: macos: - xcode: "14.0" + xcode: "14.3" resource_class: "macos.x86.medium.gen2" steps: - checkout @@ -500,7 +500,7 @@ jobs: iOS build and test: macos: - xcode: "13.4.1" + xcode: "14.3" resource_class: "macos.x86.medium.gen2" steps: - checkout @@ -513,14 +513,14 @@ jobs: - setup-rust-toolchain - restore_cache: name: Restore rubygems cache - key: swift-docs-gems-v13 + key: swift-docs-gems-v15 - run: name: Install jazzy command: gem install jazzy - save_cache: name: Save rubygems cache # NEEDS TO CHANGE WHEN JAZZY OR RUBY IS UPDATED - key: swift-docs-gems-v13 + key: swift-docs-gems-v15 paths: - ~/.gem/ruby/2.7.6 - run: @@ -538,7 +538,7 @@ jobs: DEVICES=$(xcrun xctrace list devices 2>&1) echo "$DEVICES" # Pick a device and start it - UUID=$(echo "$DEVICES" | grep --max-count=1 'iPhone 11 Simulator (14' | awk -F'[()]' '{print $4}') + UUID=$(echo "$DEVICES" | grep --max-count=1 'iPhone 14 Simulator (16' | awk -F'[()]' '{print $4}') xcrun simctl boot "$UUID" # Store build type for use in cache key if [ -z "${CIRCLE_TAG}" ]; then @@ -607,7 +607,7 @@ jobs: iOS integration test: macos: - xcode: "13.4.1" + xcode: "14.3" resource_class: "macos.x86.medium.gen2" steps: - checkout @@ -629,8 +629,8 @@ jobs: DEVICES=$(xcrun xctrace list devices 2>&1) echo "$DEVICES" # Pick a device and start it - UDID=$(echo "$DEVICES" | grep --max-count=1 'iPhone 11 Simulator (14' | awk -F'[()]' '{print $4}') - xcrun simctl boot "$UDID" + UUID=$(echo "$DEVICES" | grep --max-count=1 'iPhone 14 Simulator (16' | awk -F'[()]' '{print $4}') + xcrun simctl boot "$UUID" - run: name: Build XCFramework archive command: | @@ -665,7 +665,7 @@ jobs: iOS Framework release: macos: - xcode: "13.4.1" + xcode: "14.3" resource_class: "macos.x86.medium.gen2" steps: - checkout @@ -907,7 +907,7 @@ jobs: pypi-macos-release: macos: - xcode: "13.4.1" + xcode: "14.3" resource_class: "macos.x86.medium.gen2" steps: - install-rustup @@ -922,7 +922,7 @@ jobs: name: Build macOS x86_64 wheel command: | cd glean-core/python - .venv3.9/bin/python3 setup.py bdist_wheel + .venv3.11/bin/python3 setup.py bdist_wheel environment: GLEAN_BUILD_TARGET: x86_64-apple-darwin GLEAN_BUILD_VARIANT: release @@ -930,16 +930,16 @@ jobs: name: Build macOS aarch64 wheel command: | cd glean-core/python - .venv3.9/bin/python3 setup.py bdist_wheel + .venv3.11/bin/python3 setup.py bdist_wheel environment: - SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk + SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk GLEAN_BUILD_TARGET: aarch64-apple-darwin GLEAN_BUILD_VARIANT: release - run: name: Build macOS universal2 wheel command: | cd glean-core/python - .venv3.9/bin/python3 setup.py bdist_wheel + .venv3.11/bin/python3 setup.py bdist_wheel environment: GLEAN_BUILD_TARGET: universal GLEAN_BUILD_VARIANT: release @@ -949,7 +949,7 @@ jobs: cd glean-core/python # Requires that the TWINE_USERNAME and TWINE_PASSWORD environment # variables are configured in CircleCI's environment variables. - .venv3.9/bin/python3 -m twine upload dist/* + .venv3.11/bin/python3 -m twine upload dist/* - install-ghr-darwin - run: name: Publish to Github diff --git a/.circleci/jazzy.yml b/.circleci/jazzy.yml index 6a57b40e82..9d61646e36 100644 --- a/.circleci/jazzy.yml +++ b/.circleci/jazzy.yml @@ -10,4 +10,4 @@ xcodebuild_arguments: - "-scheme" - "Glean" - "-destination" - - "platform=iOS Simulator,name=iPhone 11" + - "platform=iOS Simulator,name=iPhone 14" diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cba9a561e..e388b55d4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,10 @@ * StringList metric type limits have been increased. The length of strings allowed has been increased from 50 to 100 to match the String metric type, and the list length has been increased from 20 to 100 ([Bug 1833870](https://bugzilla.mozilla.org/show_bug.cgi?id=1833870)) * Rust * Timing distribution traits now expose `accumulate_samples` and `accumulate_raw_samples_nanos`. This is a breaking change for consumers that make use of the trait as they will need to implement the new functions ([Bug 1829745](https://bugzilla.mozilla.org/show_bug.cgi?id=1829745)) -* Swift +* iOS * Make debugging APIs available on Swift ([#2470](https://github.com/mozilla/glean/pull/2470)) * Added a shutdown API for Swift. This should only be necessary for when Glean is running in a process other than the main process (like in the VPN daemon, for instance)([Bug 1832324](https://bugzilla.mozilla.org/show_bug.cgi?id=1832324)) + * Glean for iOS is now being built with Xcode 14.3 ([#2253](https://github.com/mozilla/glean/pull/2253)) # v52.7.0 (2023-05-10) diff --git a/bin/run-ios-build.sh b/bin/run-ios-build.sh index 65087fe3c5..9d8fd8d329 100755 --- a/bin/run-ios-build.sh +++ b/bin/run-ios-build.sh @@ -11,7 +11,7 @@ xcodebuild \ -workspace ./glean-core/ios/Glean.xcodeproj/project.xcworkspace \ -scheme Glean \ -sdk iphonesimulator \ - -destination 'platform=iOS Simulator,name=iPhone 11' \ + -destination 'platform=iOS Simulator,name=iPhone 14' \ build | \ tee raw_xcodebuild.log | \ xcpretty && exit "${PIPESTATUS[0]}" diff --git a/bin/run-ios-sample-app-build.sh b/bin/run-ios-sample-app-build.sh index a13d30ba6d..22d1a83350 100755 --- a/bin/run-ios-sample-app-build.sh +++ b/bin/run-ios-sample-app-build.sh @@ -11,7 +11,7 @@ xcodebuild \ -workspace ./samples/ios/app/glean-sample-app.xcodeproj/project.xcworkspace \ -scheme glean-sample-app \ -sdk iphonesimulator \ - -destination 'platform=iOS Simulator,name=iPhone 11' \ + -destination 'platform=iOS Simulator,name=iPhone 14' \ build | \ tee raw_sample_xcodebuild.log | \ xcpretty && exit "${PIPESTATUS[0]}" diff --git a/bin/run-ios-sample-app-test.sh b/bin/run-ios-sample-app-test.sh index c419f510c3..64b4ed3452 100755 --- a/bin/run-ios-sample-app-test.sh +++ b/bin/run-ios-sample-app-test.sh @@ -11,7 +11,7 @@ xcodebuild \ -workspace ./samples/ios/app/glean-sample-app.xcodeproj/project.xcworkspace \ -scheme glean-sample-app \ -sdk iphonesimulator \ - -destination 'platform=iOS Simulator,name=iPhone 11' \ + -destination 'platform=iOS Simulator,name=iPhone 14' \ test | \ tee raw_sample_xcodetest.log | \ xcpretty && exit "${PIPESTATUS[0]}" diff --git a/bin/run-ios-tests.sh b/bin/run-ios-tests.sh index 7ae79b5c38..0913cad9e6 100755 --- a/bin/run-ios-tests.sh +++ b/bin/run-ios-tests.sh @@ -11,7 +11,7 @@ xcodebuild \ -workspace ./glean-core/ios/Glean.xcodeproj/project.xcworkspace \ -scheme Glean \ -sdk iphonesimulator \ - -destination 'platform=iOS Simulator,name=iPhone 11' \ + -destination 'platform=iOS Simulator,name=iPhone 14' \ test | \ tee raw_xcodetest.log | \ xcpretty && exit "${PIPESTATUS[0]}" From 11ff4e804c41a1fb47190e4e086612dfe3585389 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Mon, 29 May 2023 12:50:03 +0200 Subject: [PATCH 30/74] Update Swift resolve file format --- .../xcshareddata/swiftpm/Package.resolved | 42 +++++++++---------- .../xcshareddata/swiftpm/Package.resolved | 42 +++++++++---------- 2 files changed, 40 insertions(+), 44 deletions(-) diff --git a/glean-core/ios/Glean.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/glean-core/ios/Glean.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 05934cd81a..76d8a414b0 100644 --- a/glean-core/ios/Glean.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/glean-core/ios/Glean.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,25 +1,23 @@ { - "object": { - "pins" : [ - { - "package": "GzipSwift", - "repositoryURL" : "https://github.com/1024jp/GzipSwift", - "state" : { - "branch": null, - "revision" : "7a7f17761c76a932662ab77028a4329f67d645a4", - "version" : "5.2.0" - } - }, - { - "package" : "OHHTTPStubs", - "repositoryURL" : "https://github.com/alisoftware/OHHTTPStubs", - "state" : { - "branch": null, - "revision" : "12f19662426d0434d6c330c6974d53e2eb10ecd9", - "version" : "9.1.0" - } + "pins" : [ + { + "identity" : "gzipswift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/1024jp/GzipSwift", + "state" : { + "revision" : "7a7f17761c76a932662ab77028a4329f67d645a4", + "version" : "5.2.0" } - ] - }, - "version": 1 + }, + { + "identity" : "ohhttpstubs", + "kind" : "remoteSourceControl", + "location" : "https://github.com/alisoftware/OHHTTPStubs", + "state" : { + "revision" : "12f19662426d0434d6c330c6974d53e2eb10ecd9", + "version" : "9.1.0" + } + } + ], + "version" : 2 } diff --git a/samples/ios/app/glean-sample-app.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/samples/ios/app/glean-sample-app.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 4a17b011fd..61e8323745 100644 --- a/samples/ios/app/glean-sample-app.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/samples/ios/app/glean-sample-app.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,25 +1,23 @@ { - "object": { - "pins" : [ - { - "package": "GzipSwift", - "repositoryURL" : "https://github.com/1024jp/GzipSwift", - "state" : { - "branch": null, - "revision" : "7a7f17761c76a932662ab77028a4329f67d645a4", - "version" : "5.2.0" - } - }, - { - "package" : "swifter", - "repositoryURL" : "https://github.com/httpswift/swifter", - "state" : { - "branch": null, - "revision" : "9483a5d459b45c3ffd059f7b55f9638e268632fd", - "version" : "1.5.0" - } + "pins" : [ + { + "identity" : "gzipswift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/1024jp/GzipSwift", + "state" : { + "revision" : "7a7f17761c76a932662ab77028a4329f67d645a4", + "version" : "5.2.0" } - ] - }, - "version" : 1 + }, + { + "identity" : "swifter", + "kind" : "remoteSourceControl", + "location" : "https://github.com/httpswift/swifter", + "state" : { + "revision" : "9483a5d459b45c3ffd059f7b55f9638e268632fd", + "version" : "1.5.0" + } + } + ], + "version" : 2 } From 8422da79b5ca089dce9dc50ba3091e15091bcbd3 Mon Sep 17 00:00:00 2001 From: Chris H-C Date: Tue, 16 May 2023 16:10:40 -0400 Subject: [PATCH 31/74] bug 1647630 - Expose Ping Rate Limit configuration --- CHANGELOG.md | 1 + .../src/main/java/mozilla/telemetry/glean/Glean.kt | 3 ++- glean-core/ios/Glean/Glean.swift | 1 + glean-core/python/glean/glean.py | 1 + glean-core/python/glean/net/ping_upload_worker.py | 1 + glean-core/rlb/src/configuration.rs | 7 +++++++ glean-core/rlb/src/lib.rs | 1 + glean-core/src/core/mod.rs | 13 ++++++++++--- glean-core/src/glean.udl | 7 +++++++ glean-core/src/lib.rs | 11 +++++++++++ samples/rust/src/main.rs | 1 + 11 files changed, 43 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e388b55d4b..b0bdbc40aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * General * Adds the capability to merge remote metric configurations, enabling multiple Nimbus Features or components to share this functionality ([Bug 1833381](https://bugzilla.mozilla.org/show_bug.cgi?id=1833381)) * StringList metric type limits have been increased. The length of strings allowed has been increased from 50 to 100 to match the String metric type, and the list length has been increased from 20 to 100 ([Bug 1833870](https://bugzilla.mozilla.org/show_bug.cgi?id=1833870)) + * Make ping rate limiting configurable on Glean init. ([bug 1647630](https://bugzilla.mozilla.org/show_bug.cgi?id=1647630)) * Rust * Timing distribution traits now expose `accumulate_samples` and `accumulate_raw_samples_nanos`. This is a breaking change for consumers that make use of the trait as they will need to implement the new functions ([Bug 1829745](https://bugzilla.mozilla.org/show_bug.cgi?id=1829745)) * iOS diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt index 7198f3e5b2..3a094bed73 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt @@ -245,7 +245,8 @@ open class GleanInternalAPI internal constructor() { appBuild = "none", useCoreMps = false, trimDataToRegisteredPings = false, - logLevel = configuration.logLevel + logLevel = configuration.logLevel, + rateLimit = null ) val clientInfo = getClientInfo(configuration, buildInfo) val callbacks = OnGleanEventsImpl(this@GleanInternalAPI) diff --git a/glean-core/ios/Glean/Glean.swift b/glean-core/ios/Glean/Glean.swift index 56a91d3b7a..32545f96b8 100644 --- a/glean-core/ios/Glean/Glean.swift +++ b/glean-core/ios/Glean/Glean.swift @@ -192,6 +192,7 @@ public class Glean { useCoreMps: false, trimDataToRegisteredPings: false, logLevel: configuration.logLevel + rateLimit: nil, ) let clientInfo = getClientInfo(configuration, buildInfo: buildInfo) let callbacks = OnGleanEventsImpl(glean: self) diff --git a/glean-core/python/glean/glean.py b/glean-core/python/glean/glean.py index 5a82495a22..52f253487d 100644 --- a/glean-core/python/glean/glean.py +++ b/glean-core/python/glean/glean.py @@ -231,6 +231,7 @@ def initialize( app_build=cls._application_build_id, trim_data_to_registered_pings=False, log_level=None, + rate_limit=None, ) _uniffi.glean_initialize(cfg, client_info, callbacks) diff --git a/glean-core/python/glean/net/ping_upload_worker.py b/glean-core/python/glean/net/ping_upload_worker.py index b843c00442..c80e2bbbcb 100644 --- a/glean-core/python/glean/net/ping_upload_worker.py +++ b/glean-core/python/glean/net/ping_upload_worker.py @@ -121,6 +121,7 @@ def _process(data_dir: Path, application_id: str, configuration) -> bool: app_build="", trim_data_to_registered_pings=False, log_level=None, + rate_limit=None, ) if not glean_initialize_for_subprocess(cfg): log.error("Couldn't initialize Glean in subprocess") diff --git a/glean-core/rlb/src/configuration.rs b/glean-core/rlb/src/configuration.rs index 145f1a5732..66200ee1a5 100644 --- a/glean-core/rlb/src/configuration.rs +++ b/glean-core/rlb/src/configuration.rs @@ -38,6 +38,8 @@ pub struct Configuration { pub trim_data_to_registered_pings: bool, /// The internal logging level. pub log_level: Option, + /// The rate pings may be uploaded before they are throttled. + pub rate_limit: Option, } /// Configuration builder. @@ -75,6 +77,9 @@ pub struct Builder { /// Optional: The internal logging level. /// Default: `None` pub log_level: Option, + /// Optional: The internal ping upload rate limit. + /// Default: `None` + pub rate_limit: Option, } impl Builder { @@ -95,6 +100,7 @@ impl Builder { use_core_mps: false, trim_data_to_registered_pings: false, log_level: None, + rate_limit: None, } } @@ -111,6 +117,7 @@ impl Builder { use_core_mps: self.use_core_mps, trim_data_to_registered_pings: self.trim_data_to_registered_pings, log_level: self.log_level, + rate_limit: self.rate_limit, } } diff --git a/glean-core/rlb/src/lib.rs b/glean-core/rlb/src/lib.rs index d6ad16bdc1..06c7786e0a 100644 --- a/glean-core/rlb/src/lib.rs +++ b/glean-core/rlb/src/lib.rs @@ -119,6 +119,7 @@ fn initialize_internal(cfg: Configuration, client_info: ClientInfoMetrics) -> Op use_core_mps: cfg.use_core_mps, trim_data_to_registered_pings: cfg.trim_data_to_registered_pings, log_level: cfg.log_level, + rate_limit: cfg.rate_limit, }; glean_core::glean_initialize(core_cfg, client_info.into(), callbacks); diff --git a/glean-core/src/core/mod.rs b/glean-core/src/core/mod.rs index e83d8f4f82..c1d1dc9c36 100644 --- a/glean-core/src/core/mod.rs +++ b/glean-core/src/core/mod.rs @@ -19,8 +19,8 @@ use crate::storage::{StorageManager, INTERNAL_STORAGE}; use crate::upload::{PingUploadManager, PingUploadTask, UploadResult, UploadTaskAction}; use crate::util::{local_now_with_offset, sanitize_application_id}; use crate::{ - scheduler, system, CommonMetricData, ErrorKind, InternalConfiguration, Lifetime, Result, - DEFAULT_MAX_EVENTS, GLEAN_SCHEMA_VERSION, GLEAN_VERSION, KNOWN_CLIENT_ID, + scheduler, system, CommonMetricData, ErrorKind, InternalConfiguration, Lifetime, PingRateLimit, + Result, DEFAULT_MAX_EVENTS, GLEAN_SCHEMA_VERSION, GLEAN_VERSION, KNOWN_CLIENT_ID, }; static GLEAN: OnceCell> = OnceCell::new(); @@ -113,6 +113,7 @@ where /// use_core_mps: false, /// trim_data_to_registered_pings: false, /// log_level: None, +/// rate_limit: None, /// }; /// let mut glean = Glean::new(cfg).unwrap(); /// let ping = PingType::new("sample", true, false, vec![]); @@ -175,8 +176,13 @@ impl Glean { // Create an upload manager with rate limiting of 15 pings every 60 seconds. let mut upload_manager = PingUploadManager::new(&cfg.data_path, &cfg.language_binding_name); + let rate_limit = cfg.rate_limit.as_ref().unwrap_or(&PingRateLimit { + seconds_per_interval: 60, + pings_per_interval: 15, + }); upload_manager.set_rate_limiter( - /* seconds per interval */ 60, /* max pings per interval */ 15, + rate_limit.seconds_per_interval, + rate_limit.pings_per_interval, ); // We only scan the pending ping directories when calling this from a subprocess, @@ -295,6 +301,7 @@ impl Glean { use_core_mps: false, trim_data_to_registered_pings: false, log_level: None, + rate_limit: None, }; let mut glean = Self::new(cfg).unwrap(); diff --git a/glean-core/src/glean.udl b/glean-core/src/glean.udl index 2b62a8f102..ad5ed55876 100644 --- a/glean-core/src/glean.udl +++ b/glean-core/src/glean.udl @@ -73,6 +73,13 @@ dictionary InternalConfiguration { boolean use_core_mps; boolean trim_data_to_registered_pings; LevelFilter? log_level; + PingRateLimit? rate_limit; +}; + +// How to specify the rate pings may be uploaded before they are throttled. +dictionary PingRateLimit { + u64 seconds_per_interval; + u32 pings_per_interval; }; // An enum representing the different logging levels for the `log` crate. diff --git a/glean-core/src/lib.rs b/glean-core/src/lib.rs index 71e100252f..036e0402c7 100644 --- a/glean-core/src/lib.rs +++ b/glean-core/src/lib.rs @@ -128,6 +128,17 @@ pub struct InternalConfiguration { pub trim_data_to_registered_pings: bool, /// The internal logging level. pub log_level: Option, + /// The rate at which pings may be uploaded before they are throttled. + pub rate_limit: Option, +} + +/// How to specify the rate at which pings may be uploaded before they are throttled. +#[derive(Debug, Clone)] +pub struct PingRateLimit { + /// Length of time in seconds of a ping uploading interval. + pub seconds_per_interval: u64, + /// Number of pings that may be uploaded in a ping uploading interval. + pub pings_per_interval: u32, } /// Launches a new task on the global dispatch queue with a reference to the Glean singleton. diff --git a/samples/rust/src/main.rs b/samples/rust/src/main.rs index 82412580b2..57e33cf380 100644 --- a/samples/rust/src/main.rs +++ b/samples/rust/src/main.rs @@ -38,6 +38,7 @@ fn main() { use_core_mps: true, trim_data_to_registered_pings: false, log_level: None, + rate_limit: None, }; let client_info = ClientInfoMetrics { From 8e94b7ec5988f4ee52cf350549cc17c1f762334f Mon Sep 17 00:00:00 2001 From: Chris H-C Date: Tue, 16 May 2023 16:31:51 -0400 Subject: [PATCH 32/74] bug 1647630 - Convert Configurations to ConfigurationBuilder to avoid having to add rate_limit --- glean-core/rlb/src/test.rs | 422 ++++++++------------------------- glean-core/tests/common/mod.rs | 1 + 2 files changed, 98 insertions(+), 325 deletions(-) diff --git a/glean-core/rlb/src/test.rs b/glean-core/rlb/src/test.rs index bca1993d0b..67d0b0afd0 100644 --- a/glean-core/rlb/src/test.rs +++ b/glean-core/rlb/src/test.rs @@ -43,18 +43,10 @@ fn send_a_ping() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().to_path_buf(); - let cfg = Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: Some(Box::new(FakeUploader { sender: s })), - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }; + let cfg = ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { sender: s }) + .build(); let _t = new_glean(Some(cfg), true); @@ -133,18 +125,9 @@ fn test_experiments_recording_before_glean_inits() { set_experiment_inactive("experiment_preinit_disabled".to_string()); test_reset_glean( - Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: None, - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }, + ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .build(), ClientInfoMetrics::unknown(), false, ); @@ -194,18 +177,10 @@ fn sending_of_foreground_background_pings() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().to_path_buf(); - let cfg = Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: Some(Box::new(FakeUploader { sender: s })), - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }; + let cfg = ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { sender: s }) + .build(); let _t = new_glean(Some(cfg), true); @@ -277,18 +252,10 @@ fn sending_of_startup_baseline_ping() { // Now reset Glean: it should still send a baseline ping with reason // dirty_startup when starting, because of the dirty bit being set. test_reset_glean( - Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: Some(Box::new(FakeUploader { sender: s })), - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }, + ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { sender: s }) + .build(), ClientInfoMetrics::unknown(), false, ); @@ -337,18 +304,10 @@ fn no_dirty_baseline_on_clean_shutdowns() { // Now reset Glean: it should not send a baseline ping, because // we cleared the dirty bit. test_reset_glean( - Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: Some(Box::new(FakeUploader { sender: s })), - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }, + ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { sender: s }) + .build(), ClientInfoMetrics::unknown(), false, ); @@ -368,18 +327,9 @@ fn initialize_must_not_crash_if_data_dir_is_messed_up() { let file_path = tmpdirname.to_path_buf().join("notadir"); std::fs::write(file_path.clone(), "test").expect("The test Glean dir file must be created"); - let cfg = Configuration { - data_path: file_path, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: None, - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }; + let cfg = ConfigurationBuilder::new(true, file_path, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .build(); test_reset_glean(cfg, ClientInfoMetrics::unknown(), false); @@ -415,18 +365,9 @@ fn queued_recorded_metrics_correctly_record_during_init() { // Calling `new_glean` here will cause Glean to be initialized and should cause the queued // tasks recording metrics to execute - let cfg = Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: None, - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }; + let cfg = ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .build(); let _t = new_glean(Some(cfg), false); // Verify that the callback was executed by testing for the correct value @@ -442,18 +383,9 @@ fn initializing_twice_is_a_noop() { let tmpname = dir.path().to_path_buf(); test_reset_glean( - Configuration { - data_path: tmpname.clone(), - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: None, - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }, + ConfigurationBuilder::new(true, tmpname.clone(), GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .build(), ClientInfoMetrics::unknown(), true, ); @@ -463,18 +395,9 @@ fn initializing_twice_is_a_noop() { // This will bail out early. crate::initialize( - Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: None, - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }, + ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .build(), ClientInfoMetrics::unknown(), ); @@ -492,18 +415,9 @@ fn dont_handle_events_when_uninitialized() { let tmpname = dir.path().to_path_buf(); test_reset_glean( - Configuration { - data_path: tmpname.clone(), - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: None, - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }, + ConfigurationBuilder::new(true, tmpname.clone(), GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .build(), ClientInfoMetrics::unknown(), true, ); @@ -557,18 +471,9 @@ fn the_app_channel_must_be_correctly_set_if_requested() { ..ClientInfoMetrics::unknown() }; test_reset_glean( - Configuration { - data_path: tmpname.clone(), - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: None, - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }, + ConfigurationBuilder::new(true, tmpname.clone(), GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .build(), client_info, true, ); @@ -580,18 +485,9 @@ fn the_app_channel_must_be_correctly_set_if_requested() { ..ClientInfoMetrics::unknown() }; test_reset_glean( - Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: None, - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }, + ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .build(), client_info, true, ); @@ -644,18 +540,10 @@ fn ping_collection_must_happen_after_concurrently_scheduled_metrics_recordings() let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().to_path_buf(); test_reset_glean( - Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: Some(Box::new(FakeUploader { sender: s })), - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }, + ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { sender: s }) + .build(), ClientInfoMetrics::unknown(), true, ); @@ -726,18 +614,9 @@ fn core_metrics_should_be_cleared_and_restored_when_disabling_and_enabling_uploa // No app_channel reported. test_reset_glean( - Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: None, - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }, + ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .build(), ClientInfoMetrics::unknown(), true, ); @@ -789,36 +668,19 @@ fn sending_deletion_ping_if_disabled_outside_of_run() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().to_path_buf(); - let cfg = Configuration { - data_path: tmpname.clone(), - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: None, - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }; + let cfg = ConfigurationBuilder::new(true, tmpname.clone(), GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .build(); let _t = new_glean(Some(cfg), true); // Now reset Glean and disable upload: it should still send a deletion request // ping even though we're just starting. test_reset_glean( - Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: false, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: Some(Box::new(FakeUploader { sender: s })), - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }, + ConfigurationBuilder::new(false, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { sender: s }) + .build(), ClientInfoMetrics::unknown(), false, ); @@ -856,36 +718,19 @@ fn no_sending_of_deletion_ping_if_unchanged_outside_of_run() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().to_path_buf(); - let cfg = Configuration { - data_path: tmpname.clone(), - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: None, - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }; + let cfg = ConfigurationBuilder::new(true, tmpname.clone(), GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .build(); let _t = new_glean(Some(cfg), true); // Now reset Glean and keep upload enabled: no deletion-request // should be sent. test_reset_glean( - Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: Some(Box::new(FakeUploader { sender: s })), - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }, + ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { sender: s }) + .build(), ClientInfoMetrics::unknown(), false, ); @@ -931,18 +776,9 @@ fn test_sending_of_startup_baseline_ping_with_application_lifetime_metric() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().to_path_buf(); test_reset_glean( - Configuration { - data_path: tmpname.clone(), - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: None, - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }, + ConfigurationBuilder::new(true, tmpname.clone(), GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .build(), ClientInfoMetrics::unknown(), true, ); @@ -964,18 +800,10 @@ fn test_sending_of_startup_baseline_ping_with_application_lifetime_metric() { // Restart glean and don't clear the stores. test_reset_glean( - Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: Some(Box::new(FakeUploader { sender: s })), - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }, + ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { sender: s }) + .build(), ClientInfoMetrics::unknown(), false, ); @@ -1023,18 +851,10 @@ fn setting_debug_view_tag_before_initialization_should_not_crash() { set_debug_view_tag("valid-tag"); // Create a custom configuration to use a fake uploader. - let cfg = Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: Some(Box::new(FakeUploader { sender: s })), - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }; + let cfg = ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { sender: s }) + .build(); let _t = new_glean(Some(cfg), true); @@ -1082,18 +902,10 @@ fn setting_source_tags_before_initialization_should_not_crash() { set_source_tags(vec!["valid-tag1".to_string(), "valid-tag2".to_string()]); // Create a custom configuration to use a fake uploader. - let cfg = Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: Some(Box::new(FakeUploader { sender: s })), - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }; + let cfg = ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { sender: s }) + .build(); let _t = new_glean(Some(cfg), true); @@ -1140,18 +952,10 @@ fn setting_source_tags_after_initialization_should_not_crash() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().to_path_buf(); - let cfg = Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: Some(Box::new(FakeUploader { sender: s })), - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }; + let cfg = ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { sender: s }) + .build(); let _t = new_glean(Some(cfg), true); @@ -1212,18 +1016,10 @@ fn flipping_upload_enabled_respects_order_of_events() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().to_path_buf(); - let cfg = Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: Some(Box::new(FakeUploader { sender: s })), - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }; + let cfg = ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { sender: s }) + .build(); // We create a ping and a metric before we initialize Glean let sample_ping = PingType::new("sample-ping-1", true, false, vec![]); @@ -1281,18 +1077,10 @@ fn registering_pings_before_init_must_work() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().to_path_buf(); - let cfg = Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: Some(Box::new(FakeUploader { sender: s })), - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }; + let cfg = ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { sender: s }) + .build(); let _t = new_glean(Some(cfg), true); @@ -1332,18 +1120,10 @@ fn test_a_ping_before_submission() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().to_path_buf(); - let cfg = Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: Some(Box::new(FakeUploader { sender: s })), - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }; + let cfg = ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { sender: s }) + .build(); let _t = new_glean(Some(cfg), true); @@ -1458,21 +1238,13 @@ fn signaling_done() { // We count how many times `upload` was invoked per thread. let call_count = Arc::new(Mutex::default()); - let cfg = Configuration { - data_path: tmpname, - application_id: GLOBAL_APPLICATION_ID.into(), - upload_enabled: true, - max_events: None, - delay_ping_lifetime_io: false, - server_endpoint: Some("invalid-test-host".into()), - uploader: Some(Box::new(FakeUploader { + let cfg = ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { barrier: Arc::clone(&barrier), counter: Arc::clone(&call_count), - })), - use_core_mps: false, - trim_data_to_registered_pings: false, - log_level: None, - }; + }) + .build(); let _t = new_glean(Some(cfg), true); diff --git a/glean-core/tests/common/mod.rs b/glean-core/tests/common/mod.rs index 34072b0389..897ddd6d40 100644 --- a/glean-core/tests/common/mod.rs +++ b/glean-core/tests/common/mod.rs @@ -60,6 +60,7 @@ pub fn new_glean(tempdir: Option) -> (Glean, tempfile::TempDi use_core_mps: false, trim_data_to_registered_pings: false, log_level: None, + rate_limit: None, }; let glean = Glean::new(cfg).unwrap(); From fa25133187cee0f932ee358d39893ab05fd04934 Mon Sep 17 00:00:00 2001 From: Chris H-C Date: Mon, 5 Jun 2023 15:26:20 -0400 Subject: [PATCH 33/74] bug 1647630 - Test that the global configured ping thresholds work --- glean-core/rlb/src/test.rs | 83 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/glean-core/rlb/src/test.rs b/glean-core/rlb/src/test.rs index 67d0b0afd0..2b7fe2e238 100644 --- a/glean-core/rlb/src/test.rs +++ b/glean-core/rlb/src/test.rs @@ -5,7 +5,9 @@ use std::io::Read; use std::sync::{Arc, Barrier, Mutex}; use std::thread::{self, ThreadId}; +use std::time::{Duration, Instant}; +use crossbeam_channel::RecvTimeoutError; use flate2::read::GzDecoder; use serde_json::Value as JsonValue; @@ -1274,3 +1276,84 @@ fn signaling_done() { assert_eq!(1, count, "each thread should call upload only once"); } } + +#[test] +fn configure_ping_throttling() { + let _lock = lock_test(); + + let (s, r) = crossbeam_channel::bounded::(1); + + // Define a fake uploader that reports back the submission URL + // using a crossbeam channel. + #[derive(Debug)] + pub struct FakeUploader { + sender: crossbeam_channel::Sender, + done: Arc, + } + impl net::PingUploader for FakeUploader { + fn upload( + &self, + url: String, + _body: Vec, + _headers: Vec<(String, String)>, + ) -> net::UploadResult { + if self.done.load(std::sync::atomic::Ordering::SeqCst) { + // If we've outlived the test, just lie. + return net::UploadResult::http_status(200); + } + self.sender.send(url).unwrap(); + net::UploadResult::http_status(200) + } + } + + // Create a custom configuration to use a fake uploader. + let dir = tempfile::tempdir().unwrap(); + let tmpname = dir.path().to_path_buf(); + + let done = Arc::new(std::sync::atomic::AtomicBool::new(false)); + let mut cfg = ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { + sender: s, + done: Arc::clone(&done), + }) + .build(); + let pings_per_interval = 10; + cfg.rate_limit = Some(glean_core::PingRateLimit { + seconds_per_interval: 1, + pings_per_interval, + }); + + let _t = new_glean(Some(cfg), true); + + // Define a new ping. + const PING_NAME: &str = "test-ping"; + let custom_ping = private::PingType::new(PING_NAME, true, true, vec![]); + + // Submit and receive it `pings_per_interval` times. + for _ in 0..pings_per_interval { + custom_ping.submit(None); + + // Wait for the ping to arrive. + let url = r.recv().unwrap(); + assert!(url.contains(PING_NAME)); + } + + // Submit one ping more than the rate limit permits. + custom_ping.submit(None); + + // We'd expect it to be received within 250ms if it weren't throttled. + let now = Instant::now(); + assert_eq!( + r.recv_deadline(now + Duration::from_millis(250)), + Err(RecvTimeoutError::Timeout) + ); + + // We still have to deal with that eleventh ping. + // When it eventually processes after the throttle interval, this'll tell + // it that it's done. + done.store(true, std::sync::atomic::Ordering::SeqCst); + // Unfortunately, we'll still be stuck waiting the full + // `seconds_per_interval` before running the next test, since shutting down + // will wait for the queue to clear. +} From d2dfc0d7621cf4b172add60dd8e36863a51162b0 Mon Sep 17 00:00:00 2001 From: Chris H-C Date: Mon, 5 Jun 2023 16:48:08 -0400 Subject: [PATCH 34/74] Fix iOS build --- glean-core/ios/Glean/Glean.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glean-core/ios/Glean/Glean.swift b/glean-core/ios/Glean/Glean.swift index 32545f96b8..499fcb02f7 100644 --- a/glean-core/ios/Glean/Glean.swift +++ b/glean-core/ios/Glean/Glean.swift @@ -191,8 +191,8 @@ public class Glean { appBuild: "0.0.0", useCoreMps: false, trimDataToRegisteredPings: false, - logLevel: configuration.logLevel - rateLimit: nil, + logLevel: configuration.logLevel, + rateLimit: nil ) let clientInfo = getClientInfo(configuration, buildInfo: buildInfo) let callbacks = OnGleanEventsImpl(glean: self) From 00b18e7adb7009f9d2000c2bfe73532767d8bcb9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 May 2023 06:19:04 +0000 Subject: [PATCH 35/74] Bump requests from 2.28.2 to 2.31.0 in /taskcluster Bumps [requests](https://github.com/psf/requests) from 2.28.2 to 2.31.0. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.28.2...v2.31.0) --- updated-dependencies: - dependency-name: requests dependency-type: indirect ... Signed-off-by: dependabot[bot] --- taskcluster/requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/taskcluster/requirements.txt b/taskcluster/requirements.txt index f778a5efd5..ce25984430 100644 --- a/taskcluster/requirements.txt +++ b/taskcluster/requirements.txt @@ -445,9 +445,9 @@ redo==2.0.4 \ --hash=sha256:81066955041c853b0e6491eb65a0877dce45131c4cfa3d42d923fc2aa8f7a043 \ --hash=sha256:c76e4c23ab2f8840261736a851323cd98493710e7a9d36a1058535dca501f293 # via taskcluster-taskgraph -requests==2.28.2 \ - --hash=sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa \ - --hash=sha256:98b1b2782e3c6c4904938b84c0eb932721069dfdb9134313beff7c83c2df24bf +requests==2.31.0 \ + --hash=sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f \ + --hash=sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1 # via # requests-unixsocket # taskcluster From c778c88f8809eef37f5c51a3a76a07ae061bb2a7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Jun 2023 12:32:25 +0000 Subject: [PATCH 36/74] Bump flake8-bugbear from 23.5.9 to 23.6.5 in /glean-core/python Bumps [flake8-bugbear](https://github.com/PyCQA/flake8-bugbear) from 23.5.9 to 23.6.5. - [Release notes](https://github.com/PyCQA/flake8-bugbear/releases) - [Commits](https://github.com/PyCQA/flake8-bugbear/compare/23.5.9...23.6.5) --- updated-dependencies: - dependency-name: flake8-bugbear dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- glean-core/python/requirements_dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glean-core/python/requirements_dev.txt b/glean-core/python/requirements_dev.txt index 3545f8e18c..335be320c7 100644 --- a/glean-core/python/requirements_dev.txt +++ b/glean-core/python/requirements_dev.txt @@ -2,7 +2,7 @@ auditwheel==5.3.0 black==23.3.0; python_version > '3.6' coverage==7.2.2; python_version > '3.6' flake8==6.0.0; python_version >= '3.8' -flake8-bugbear==23.5.9; python_version >= '3.8' +flake8-bugbear==23.6.5; python_version >= '3.8' jsonschema==3.2.0 mypy==1.3.0; python_version > '3.6' pdoc3==0.10.0 From f820df4f1de839572260eea1e034da577ae262a5 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Wed, 7 Jun 2023 11:05:20 +0200 Subject: [PATCH 37/74] Bumped version to 53.0.0 --- .buildconfig.yml | 2 +- CHANGELOG.md | 6 +++++- Cargo.lock | 4 ++-- DEPENDENCIES.md | 4 ++-- glean-core/Cargo.toml | 2 +- glean-core/python/setup.py | 2 +- glean-core/rlb/Cargo.toml | 4 ++-- .../telemetry/glean-gradle-plugin/GleanGradlePlugin.groovy | 2 +- 8 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.buildconfig.yml b/.buildconfig.yml index 4a79ee0ca4..448f15e0d1 100644 --- a/.buildconfig.yml +++ b/.buildconfig.yml @@ -1,4 +1,4 @@ -libraryVersion: 52.7.0 +libraryVersion: 53.0.0 groupId: org.mozilla.telemetry projects: glean: diff --git a/CHANGELOG.md b/CHANGELOG.md index b0bdbc40aa..c021378fcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Unreleased changes -[Full changelog](https://github.com/mozilla/glean/compare/v52.7.0...main) +[Full changelog](https://github.com/mozilla/glean/compare/v53.0.0...main) + +# v53.0.0 (2023-06-07) + +[Full changelog](https://github.com/mozilla/glean/compare/v52.7.0...v53.0.0) * General * Adds the capability to merge remote metric configurations, enabling multiple Nimbus Features or components to share this functionality ([Bug 1833381](https://bugzilla.mozilla.org/show_bug.cgi?id=1833381)) diff --git a/Cargo.lock b/Cargo.lock index be776e4ab7..88bc765d31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -318,7 +318,7 @@ dependencies = [ [[package]] name = "glean" -version = "52.7.0" +version = "53.0.0" dependencies = [ "chrono", "crossbeam-channel", @@ -361,7 +361,7 @@ dependencies = [ [[package]] name = "glean-core" -version = "52.7.0" +version = "53.0.0" dependencies = [ "android_logger", "bincode", diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index d8a198ac46..ab6008152e 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -4543,9 +4543,9 @@ You may use this code under the terms of either license. The following text applies to code linked from these dependencies: -* [glean 52.7.0]( https://github.com/mozilla/glean ) +* [glean 53.0.0]( https://github.com/mozilla/glean ) * [glean-build 7.1.0]( https://github.com/mozilla/glean ) -* [glean-core 52.7.0]( https://github.com/mozilla/glean ) +* [glean-core 53.0.0]( https://github.com/mozilla/glean ) * [zeitstempel 0.1.1]( https://github.com/badboy/zeitstempel ) ``` diff --git a/glean-core/Cargo.toml b/glean-core/Cargo.toml index 575680085f..609a04bb62 100644 --- a/glean-core/Cargo.toml +++ b/glean-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "glean-core" -version = "52.7.0" +version = "53.0.0" authors = ["Jan-Erik Rediger ", "The Glean Team "] description = "A modern Telemetry library" repository = "https://github.com/mozilla/glean" diff --git a/glean-core/python/setup.py b/glean-core/python/setup.py index 475dc89a57..11550fd883 100644 --- a/glean-core/python/setup.py +++ b/glean-core/python/setup.py @@ -56,7 +56,7 @@ history = history_file.read() # glean version. Automatically updated by the bin/prepare_release.sh script -version = "52.7.0" +version = "53.0.0" requirements = [ "semver>=2.13.0", diff --git a/glean-core/rlb/Cargo.toml b/glean-core/rlb/Cargo.toml index 08670ce5fe..237da778c6 100644 --- a/glean-core/rlb/Cargo.toml +++ b/glean-core/rlb/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "glean" -version = "52.7.0" +version = "53.0.0" authors = ["Jan-Erik Rediger ", "The Glean Team "] description = "Glean SDK Rust language bindings" repository = "https://github.com/mozilla/glean" @@ -23,7 +23,7 @@ maintenance = { status = "actively-developed" } [dependencies.glean-core] path = ".." -version = "52.7.0" +version = "53.0.0" [dependencies] crossbeam-channel = "0.5" diff --git a/gradle-plugin/src/main/groovy/mozilla/telemetry/glean-gradle-plugin/GleanGradlePlugin.groovy b/gradle-plugin/src/main/groovy/mozilla/telemetry/glean-gradle-plugin/GleanGradlePlugin.groovy index ff7166c985..dc5529e995 100644 --- a/gradle-plugin/src/main/groovy/mozilla/telemetry/glean-gradle-plugin/GleanGradlePlugin.groovy +++ b/gradle-plugin/src/main/groovy/mozilla/telemetry/glean-gradle-plugin/GleanGradlePlugin.groovy @@ -555,7 +555,7 @@ except: void apply(Project project) { isOffline = project.gradle.startParameter.offline - project.ext.glean_version = "52.7.0" + project.ext.glean_version = "53.0.0" def parserVersion = gleanParserVersion(project) // Print the required glean_parser version to the console. This is From ac87610bf3a058fba10206cf98ffc9fac932ef06 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 May 2023 05:57:21 +0000 Subject: [PATCH 38/74] Bump inherent from 1.0.5 to 1.0.7 (from PR #2483) Bumps [inherent](https://github.com/dtolnay/inherent) from 1.0.5 to 1.0.7. - [Release notes](https://github.com/dtolnay/inherent/releases) - [Commits](https://github.com/dtolnay/inherent/compare/1.0.5...1.0.7) --- Cargo.lock | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 88bc765d31..9292957599 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -57,7 +57,7 @@ checksum = "87bf87e6e8b47264efa9bde63d6225c6276a52e05e91bf37eaa8afd0032d6b71" dependencies = [ "askama_shared", "proc-macro2", - "syn", + "syn 1.0.105", ] [[package]] @@ -79,7 +79,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn", + "syn 1.0.105", "toml", ] @@ -210,7 +210,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" dependencies = [ "quote", - "syn", + "syn 1.0.105", ] [[package]] @@ -441,13 +441,13 @@ dependencies = [ [[package]] name = "inherent" -version = "1.0.5" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca36b2075a0e4eaa6fa1cf0ebf4cf6fc7b6a4834783dea1c25ba68245744a053" +checksum = "20cc83c51f04b1ad3b24cbac53d2ec1a138d699caabe05d315cb8538e8624d01" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.17", ] [[package]] @@ -716,18 +716,18 @@ checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.21" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -826,7 +826,7 @@ checksum = "bdbda6ac5cd1321e724fa9cee216f3a61885889b896f073b8f82322789c5250e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.105", ] [[package]] @@ -855,7 +855,7 @@ checksum = "42a3df25b0713732468deadad63ab9da1f1fd75a48a15024b50363f128db627e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.105", ] [[package]] @@ -892,6 +892,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45b6ddbb36c5b969c182aec3c4a0bce7df3fbad4b77114706a49aacc80567388" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "tempfile" version = "3.4.0" @@ -937,7 +948,7 @@ checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.105", ] [[package]] @@ -1059,7 +1070,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03de61393a42b4ad4984a3763c0600594ac3e57e5aaa1d05cede933958987c03" dependencies = [ "quote", - "syn", + "syn 1.0.105", ] [[package]] @@ -1091,7 +1102,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn", + "syn 1.0.105", "toml", "uniffi_build", "uniffi_meta", From 804ea291762142e0cb378684f251bb9a1ce9cbf6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 May 2023 05:12:27 +0000 Subject: [PATCH 39/74] Bump log from 0.4.17 to 0.4.18 (from PR #2485) Bumps [log](https://github.com/rust-lang/log) from 0.4.17 to 0.4.18. - [Release notes](https://github.com/rust-lang/log/releases) - [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/log/compare/0.4.17...0.4.18) --- Cargo.lock | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9292957599..a7e905cb26 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -581,12 +581,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" [[package]] name = "memchr" From 0f4cd349b0cf2f3c493241c47e027ceb8ba635ef Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Thu, 1 Jun 2023 13:53:14 +0200 Subject: [PATCH 40/74] Allow syn v1 and v2 for the time being --- deny.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deny.toml b/deny.toml index 1211d13ae3..1f76024185 100644 --- a/deny.toml +++ b/deny.toml @@ -20,6 +20,8 @@ skip = [ # wasi 0.10 and 0.11 are allowed # (m-c patches 0.10 to 0.11) { name = "wasi", version = "0.11.0" }, + # Allow both syn v1 and v2 for the time being + { name = "syn", version = "1.0.105" }, ] # Avoid certain crates From 0c95ef0846630326f412f16aa93579b184b58661 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Thu, 1 Jun 2023 13:58:08 +0200 Subject: [PATCH 41/74] Rust: (selective) dependency updates & vetting --- Cargo.lock | 48 +++++++++---------- glean-core/Cargo.toml | 4 +- glean-core/rlb/Cargo.toml | 2 +- supply-chain/audits.toml | 48 +++++++++++++++++++ supply-chain/config.toml | 20 ++------ supply-chain/imports.lock | 98 ++++++++++++++++++++++++++++++++++++++- 6 files changed, 175 insertions(+), 45 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a7e905cb26..cfc03c024e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,9 +28,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.68" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" [[package]] name = "arrayref" @@ -205,12 +205,12 @@ dependencies = [ [[package]] name = "ctor" -version = "0.1.26" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" +checksum = "1586fa608b1dab41f667475b4a41faec5ba680aee428bfa5de4ea520fdc6e901" dependencies = [ "quote", - "syn 1.0.105", + "syn 2.0.18", ] [[package]] @@ -447,7 +447,7 @@ checksum = "20cc83c51f04b1ad3b24cbac53d2ec1a138d699caabe05d315cb8538e8624d01" dependencies = [ "proc-macro2", "quote", - "syn 2.0.17", + "syn 2.0.18", ] [[package]] @@ -663,9 +663,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "ordered-float" @@ -731,9 +731,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.13" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags", ] @@ -837,22 +837,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.150" +version = "1.0.163" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e326c9ec8042f1b5da33252c8a37e9ffbd2c9bef0155215b6e6c80c790e05f91" +checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.150" +version = "1.0.163" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a3df25b0713732468deadad63ab9da1f1fd75a48a15024b50363f128db627e" +checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" dependencies = [ "proc-macro2", "quote", - "syn 1.0.105", + "syn 2.0.18", ] [[package]] @@ -891,9 +891,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45b6ddbb36c5b969c182aec3c4a0bce7df3fbad4b77114706a49aacc80567388" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ "proc-macro2", "quote", @@ -930,22 +930,22 @@ checksum = "b7b3e525a49ec206798b40326a44121291b530c963cfb01018f63e135bac543d" [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 1.0.105", + "syn 2.0.18", ] [[package]] @@ -1000,9 +1000,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" diff --git a/glean-core/Cargo.toml b/glean-core/Cargo.toml index 609a04bb62..734cf1cec8 100644 --- a/glean-core/Cargo.toml +++ b/glean-core/Cargo.toml @@ -35,7 +35,7 @@ bincode = "1.2.1" log = "0.4.8" uuid = { version = "1.0", features = ["v4"] } chrono = { version = "0.4.10", features = ["serde"] } -once_cell = "1.4.1" +once_cell = "1.18.0" flate2 = "1.0.19" zeitstempel = "0.1.0" crossbeam-channel = "0.5" @@ -54,7 +54,7 @@ oslog = { version = "0.1.0", default-features = false, features = ["logger"] } env_logger = { version = "0.10.0", default-features = false, features = ["auto-color", "humantime"] } tempfile = "3.1.0" iso8601 = "0.4" -ctor = "0.1.12" +ctor = "0.2.2" [build-dependencies] uniffi = { version = "0.23.0", default-features = false, features = ["build"] } diff --git a/glean-core/rlb/Cargo.toml b/glean-core/rlb/Cargo.toml index 237da778c6..6668673db9 100644 --- a/glean-core/rlb/Cargo.toml +++ b/glean-core/rlb/Cargo.toml @@ -29,7 +29,7 @@ version = "53.0.0" crossbeam-channel = "0.5" inherent = "1" log = "0.4.8" -once_cell = "1.2.0" +once_cell = "1.18.0" thiserror = "1.0.4" serde_json = "1.0.44" serde = { version = "1.0.104", features = ["derive"] } diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml index 136ed60cfc..5f6dcbf4da 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml @@ -14,3 +14,51 @@ who = "Jan-Erik Rediger " criteria = "safe-to-deploy" delta = "0.5.7 -> 0.5.8" notes = "Reviewed the fix, previous versions indeed had were able to trigger a race condition" + +[[audits.ctor]] +who = "Jan-Erik Rediger " +criteria = "safe-to-run" +delta = "0.1.26 -> 0.2.2" +notes = "Dependency updates only" + +[[audits.inherent]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +delta = "1.0.5 -> 1.0.7" +notes = "Dependency updates only" + +[[audits.log]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +delta = "0.4.17 -> 0.4.18" +notes = "One dependency removed, others updated (which we don't rely on), some APIs (which we don't use) changed." + +[[audits.proc-macro2]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +delta = "1.0.57 -> 1.0.59" +notes = "Enabled on Wasm" + +[[audits.quote]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +delta = "1.0.27 -> 1.0.28" +notes = "Enabled on wasm targets" + +[[audits.serde]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +delta = "1.0.150 -> 1.0.160" +notes = "Small API improvements, fixing broken code generation for edge cases and updating to syn v2" + +[[audits.serde_derive]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +delta = "1.0.150 -> 1.0.160" +notes = "Update of syn dependency and thus largely changes to adopt the newer API" + +[[audits.unicode-ident]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +delta = "1.0.8 -> 1.0.9" +notes = "Dependency updates only" diff --git a/supply-chain/config.toml b/supply-chain/config.toml index 45a4d12ba9..c60cae930f 100644 --- a/supply-chain/config.toml +++ b/supply-chain/config.toml @@ -180,10 +180,6 @@ criteria = "safe-to-deploy" version = "0.1.4" criteria = "safe-to-deploy" -[[exemptions.lmdb-rkv]] -version = "0.14.0" -criteria = "safe-to-deploy" - [[exemptions.lmdb-rkv-sys]] version = "0.11.2" criteria = "safe-to-deploy" @@ -288,6 +284,10 @@ criteria = "safe-to-deploy" version = "1.0.105" criteria = "safe-to-deploy" +[[exemptions.syn]] +version = "2.0.18" +criteria = "safe-to-deploy" + [[exemptions.tempfile]] version = "3.4.0" criteria = "safe-to-deploy" @@ -296,14 +296,6 @@ criteria = "safe-to-deploy" version = "1.2.0" criteria = "safe-to-deploy" -[[exemptions.thiserror]] -version = "1.0.37" -criteria = "safe-to-deploy" - -[[exemptions.thiserror-impl]] -version = "1.0.37" -criteria = "safe-to-deploy" - [[exemptions.time]] version = "0.1.45" criteria = "safe-to-deploy" @@ -312,10 +304,6 @@ criteria = "safe-to-deploy" version = "0.5.10" criteria = "safe-to-deploy" -[[exemptions.unicode-ident]] -version = "1.0.5" -criteria = "safe-to-deploy" - [[exemptions.uuid]] version = "1.3.0" criteria = "safe-to-deploy" diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock index 6edb69c954..8b37459864 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -8,6 +8,11 @@ user-id = 48 user-login = "badboy" user-name = "Jan-Erik Rediger" +[[audits.bytecode-alliance.audits.anyhow]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +delta = "1.0.69 -> 1.0.71" + [[audits.bytecode-alliance.audits.arrayref]] who = "Nick Fitzgerald " criteria = "safe-to-deploy" @@ -83,6 +88,16 @@ criteria = "safe-to-deploy" version = "0.3.25" notes = "This crate shells out to the pkg-config executable, but it appears to sanitize inputs reasonably." +[[audits.bytecode-alliance.audits.proc-macro2]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +delta = "1.0.51 -> 1.0.57" + +[[audits.bytecode-alliance.audits.quote]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +delta = "1.0.23 -> 1.0.27" + [[audits.bytecode-alliance.audits.rustix]] who = "Dan Gohman " criteria = "safe-to-deploy" @@ -127,6 +142,11 @@ This crate has no unsafe code and does not use `std::*`. Skimming the crate it does not attempt to out of the bounds of what it's already supposed to be doing. """ +[[audits.bytecode-alliance.audits.unicode-ident]] +who = "Pat Hickey " +criteria = "safe-to-deploy" +version = "1.0.8" + [[audits.bytecode-alliance.audits.unicode-normalization]] who = "Alex Crichton " criteria = "safe-to-deploy" @@ -262,10 +282,53 @@ who = "Johan Andersson " criteria = "safe-to-deploy" version = "1.0.58" -[[audits.isrg.audits.proc-macro2]] +[[audits.embark-studios.audits.epaint]] +who = "Johan Andersson " +criteria = "safe-to-deploy" +violation = "<0.20.0" +notes = "Specified crate license does not include licenses of embedded fonts if using default features or the `default_fonts` feature. Tracked in: https://github.com/emilk/egui/issues/2321" + +[[audits.embark-studios.audits.thiserror]] +who = "Johan Andersson " +criteria = "safe-to-deploy" +version = "1.0.40" +notes = "Wrapper over implementation crate, found no unsafe or ambient capabilities used" + +[[audits.embark-studios.audits.thiserror-impl]] +who = "Johan Andersson " +criteria = "safe-to-deploy" +version = "1.0.40" +notes = "Found no unsafe or ambient capabilities used" + +[[audits.isrg.audits.once_cell]] +who = "Brandon Pitman " +criteria = "safe-to-deploy" +delta = "1.17.1 -> 1.17.2" + +[[audits.isrg.audits.once_cell]] +who = "David Cook " +criteria = "safe-to-deploy" +delta = "1.17.2 -> 1.18.0" + +[[audits.isrg.audits.serde]] +who = "Brandon Pitman " +criteria = "safe-to-deploy" +delta = "1.0.160 -> 1.0.162" + +[[audits.isrg.audits.serde]] who = "David Cook " criteria = "safe-to-deploy" -delta = "1.0.49 -> 1.0.47" +delta = "1.0.162 -> 1.0.163" + +[[audits.isrg.audits.serde_derive]] +who = "Brandon Pitman " +criteria = "safe-to-deploy" +delta = "1.0.160 -> 1.0.162" + +[[audits.isrg.audits.serde_derive]] +who = "David Cook " +criteria = "safe-to-deploy" +delta = "1.0.162 -> 1.0.163" [[audits.mozilla.audits.android_logger]] who = "Jan-Erik Rediger " @@ -319,6 +382,12 @@ criteria = "safe-to-deploy" delta = "1.0.62 -> 1.0.68" aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" +[[audits.mozilla.audits.anyhow]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "1.0.68 -> 1.0.69" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + [[audits.mozilla.audits.askama]] who = "Bobby Holley " criteria = "safe-to-deploy" @@ -360,6 +429,13 @@ version = "1.4.0" notes = "I have read over the macros, and audited the unsafe code." aggregated-from = "https://raw.githubusercontent.com/mozilla/cargo-vet/main/supply-chain/audits.toml" +[[audits.mozilla.audits.lmdb-rkv]] +who = "Bobby Holley " +criteria = "safe-to-deploy" +version = "0.14.0" +notes = "Victor and Myk developed this crate at Mozilla." +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + [[audits.mozilla.audits.log]] who = "Mike Hommey " criteria = "safe-to-deploy" @@ -428,6 +504,12 @@ criteria = "safe-to-deploy" delta = "1.0.43 -> 1.0.49" aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" +[[audits.mozilla.audits.proc-macro2]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "1.0.49 -> 1.0.51" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + [[audits.mozilla.audits.quote]] who = "Nika Layzell " criteria = "safe-to-deploy" @@ -450,6 +532,18 @@ criteria = "safe-to-deploy" delta = "1.0.18 -> 1.0.21" aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" +[[audits.mozilla.audits.quote]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "1.0.21 -> 1.0.23" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + +[[audits.mozilla.audits.redox_syscall]] +who = "Mike Hommey " +criteria = "safe-to-deploy" +delta = "0.2.13 -> 0.2.16" +aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" + [[audits.mozilla.audits.rkv]] who = "Chris H-C " criteria = "safe-to-deploy" From aaa374fc2f547ce9c84828c1d1f09e40c8a7acc6 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Mon, 12 Jun 2023 14:43:19 +0200 Subject: [PATCH 42/74] docs: Update data sensitivity categories [doc only] --- .dictionary | 5 ++++- docs/user/reference/metrics/url.md | 4 ++-- docs/user/reference/yaml/metrics.md | 35 ++++++++++++++++++++--------- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/.dictionary b/.dictionary index b7bb4ceb2f..f01ed16196 100644 --- a/.dictionary +++ b/.dictionary @@ -1,4 +1,4 @@ -personal_ws-1.1 en 264 utf-8 +personal_ws-1.1 en 267 utf-8 AAR AARs ABI @@ -114,6 +114,7 @@ backport barcode bincode bindgen +biometric bool boolean booleans @@ -152,6 +153,7 @@ envs exe experimentId ffi +fi func gfritzsche glibc @@ -259,6 +261,7 @@ vendoring webextension webpages whatsys +wi xcframework xcpretty yaml diff --git a/docs/user/reference/metrics/url.md b/docs/user/reference/metrics/url.md index 34582d4559..a2b45c30e0 100644 --- a/docs/user/reference/metrics/url.md +++ b/docs/user/reference/metrics/url.md @@ -343,8 +343,8 @@ refer to the metrics [YAML format](../yaml/index.md) reference page. ## Note on `data_sensitivity` of URL metrics > URL metrics can only either be on categories 3 or 4, namely -> ["Web activity data"](../yaml/metrics.md#category-3-web-activity-data-web_activity) or -> ["Highly sensitive data"](../yaml/metrics.md#category-4-highly-sensitive-data-highly_sensitive). +> ["Stored Content & Communications"](../yaml/metrics.md#category-3-stored-content--communications-stored_content) or +> ["Highly sensitive data"](../yaml/metrics.md#category-4-highly-sensitive-data-or-clearly-identifiable-personal-data-highly_sensitive). ### Extra metric parameters diff --git a/docs/user/reference/yaml/metrics.md b/docs/user/reference/yaml/metrics.md index 0e0a226256..675aac515d 100644 --- a/docs/user/reference/yaml/metrics.md +++ b/docs/user/reference/yaml/metrics.md @@ -265,18 +265,33 @@ used by websites, add-ons, and other 3rd-party software that interact with Firef Information about the user’s direct engagement with Firefox. Examples include how many tabs, add-ons, or windows a user has open; uses of specific Firefox features; session length, scrolls and clicks; and the status of discrete user preferences. +It also includes information about the user's in-product journeys and product choices helpful to understand engagement (attitudes). +For example, selections of add-ons or tiles to determine potential interest categories etc. -##### Category 3: Web activity data (`web_activity`) +##### Category 3: Stored Content & Communications (`stored_content`) -Information about user web browsing that could be considered sensitive. -Examples include users’ specific web browsing history; general information -about their web browsing history (such as TLDs or categories of webpages visited over time); -and potentially certain types of interaction data about specific webpages visited. +_(formerly Web activity data, `web_activity`)_ -##### Category 4: Highly sensitive data (`highly_sensitive`) +Information about what people store, sync, communicate or connect to where the information is generally considered +to be more sensitive and personal in nature. +Examples include users' saved URLs or URL history, specific web browsing history, +general information about their web browsing history (such as TLDs or categories of webpages visited over time) +and potentially certain types of interaction data about specific web pages or stories visited +(such as highlighted portions of a story). +It also includes information such as content saved by users to an individual account like saved URLs, +tags, notes, passwords and files as well as communications that users have with one another through a Mozilla service. + +##### Category 4: Highly sensitive data or clearly identifiable personal data (`highly_sensitive`) Information that directly identifies a person, or if combined with other data could identify a person. -Examples include e-mail, usernames, identifiers such as google ad id, apple id, Firefox account, -city or country (unless small ones are explicitly filtered out), or certain cookies. -It may be embedded within specific website content, such as memory contents, dumps, -captures of screen data, or DOM data. +This data may be embedded within specific website content, such as memory contents, dumps, captures of screen data, or DOM data. +Examples include account registration data like name, password, and email address associated with an account, +payment data in connection with subscriptions or donations, contact information such as phone numbers or mailing addresses, +email addresses associated with surveys, promotions and customer support contacts. +It also includes any data from different categories that, when combined, can identify a person, device, household or account. +For example Category 1 log data combined with Category 3 saved URLs. +Additional examples are: voice audio commands (including a voice audio file), +speech-to-text or text-to-speech (including transcripts), biometric data, demographic information, +and precise location data associated with a persistent identifier, individual or small population cohorts. +This is location inferred or determined from mechanisms other than IP such as wi-fi access points, Bluetooth beacons, +cell phone towers or provided directly to us, such as in a survey or a profile. From 12fbdc2f56c3d15868172b68c50a9228d77241b5 Mon Sep 17 00:00:00 2001 From: Chris H-C Date: Mon, 12 Jun 2023 14:07:53 -0400 Subject: [PATCH 43/74] bug 1837996 - Document new rate_limit configuration property --- docs/user/reference/general/initializing.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/user/reference/general/initializing.md b/docs/user/reference/general/initializing.md index f932e0b33a..ba6b59f590 100644 --- a/docs/user/reference/general/initializing.md +++ b/docs/user/reference/general/initializing.md @@ -68,6 +68,9 @@ Below are listed the configuration options available on most SDKs. for users that wish to use specific uploader implementations. See [Custom Uploaders](#custom-uploaders) for more information on how and when the use this feature. - `logLevel`: The level for how verbose the internal logging is. The level filter options in order from least to most verbose are: `Off`, `Error`, `Warn`, `Info`, `Debug`, `Trace`. See the [`log` crate docs](https://docs.rs/log/latest/log/) for more information. +- `rateLimit`: Optional. + Specifies the maximum number of pings that can be uploaded per interval of a specified number of seconds. + Default is to use the SDK default (presently 15 pings per 60s interval). To learn about SDK specific configuration options available, refer to the [Reference](#reference) section. From 30e78dcc1e844597ab68065e7dd9aee954d01af9 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Tue, 13 Jun 2023 00:47:21 -0400 Subject: [PATCH 44/74] Update Kotlin Coroutines to version 1.7.1 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a559ecd1a1..342725a00e 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ buildscript { // versions below must match the ones in that repository. ext.versions = [ android_gradle_plugin: '7.4.2', - coroutines: '1.6.4', + coroutines: '1.7.1', jna: '5.13.0', junit: '4.12', mockito: '3.11.2', From 9e8fdd98a19e1f872014a74e191e7595ebe0feb9 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Mon, 12 Jun 2023 23:43:37 -0400 Subject: [PATCH 45/74] Set Kotlin JVM target mode to error Makes JVM target version mismatches fatal during the build. Default option for Gradle 8.0+. --- gradle.properties | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gradle.properties b/gradle.properties index 96c34d118a..12caf2cf2b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,3 +23,7 @@ libLicense=MPL-2.0 libLicenseUrl=https://www.mozilla.org/en-US/MPL/2.0/ android.useAndroidX=true + +# Make JVM target version mismatches fatal. +# Default setting for Gradle 8.0+ +kotlin.jvm.target.validation.mode=error From d4fdc242e6f35e403cac0fb5c5098c970783627e Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Mon, 12 Jun 2023 23:46:49 -0400 Subject: [PATCH 46/74] Consolidate JVM target setting in root project build.gradle --- build.gradle | 28 ++++++++++++------- glean-core/android-native/build.gradle | 7 ----- glean-core/android/build.gradle | 13 --------- .../glean/scheduler/PingUploadWorker.kt | 1 + samples/android/app/build.gradle | 5 ---- 5 files changed, 19 insertions(+), 35 deletions(-) diff --git a/build.gradle b/build.gradle index 342725a00e..eca7966e41 100644 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,8 @@ buildscript { ndkVersion: "25.2.9519653", // Keep it in sync in TC Dockerfile. compileSdkVersion: 33, targetSdkVersion: 33, - minSdkVersion: 21, // So that we can publish for aarch64. + minSdkVersion: 21, + jvmTargetCompatibility: 11, ] repositories { @@ -143,15 +144,22 @@ ext.rustTargets += ext.nativeRustTarget subprojects { apply plugin: 'maven-publish' - // Enable Kotlin warnings as errors for all modules - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions.allWarningsAsErrors = true - kotlinOptions { - // FIXME: Currently required for `toUByteArray` in the ping uploader. - // Should probably be handled with an annotation. - freeCompilerArgs += [ - "-Xopt-in=kotlin.ExperimentalUnsignedTypes", - ] + + // Kotlin settings applicable to all modules. + afterEvaluate { + if (it.hasProperty('android')) { + android { + // This shouldn't be needed anymore with AGP 8.1.0+ + // https://kotlinlang.org/docs/gradle-configure-project.html#gradle-java-toolchains-support + compileOptions { + sourceCompatibility rootProject.ext.build.jvmTargetCompatibility + targetCompatibility rootProject.ext.build.jvmTargetCompatibility + } + } + } + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + kotlinOptions.allWarningsAsErrors = true + kotlin.jvmToolchain(rootProject.ext.build.jvmTargetCompatibility) } } diff --git a/glean-core/android-native/build.gradle b/glean-core/android-native/build.gradle index 15584b479e..200f1ffc05 100644 --- a/glean-core/android-native/build.gradle +++ b/glean-core/android-native/build.gradle @@ -42,13 +42,6 @@ android { // Uncomment to include debug symbols in native library builds. // packagingOptions { doNotStrip "**/*.so" } - - // This is required to support new AndroidX support libraries. - // See mozilla-mobile/android-components#842 - compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 - } } cargo { diff --git a/glean-core/android/build.gradle b/glean-core/android/build.gradle index 33b7849493..9b39962bd6 100644 --- a/glean-core/android/build.gradle +++ b/glean-core/android/build.gradle @@ -69,19 +69,6 @@ android { // Uncomment to include debug symbols in native library builds. // packagingOptions { doNotStrip "**/*.so" } - // This is required to support new AndroidX support libraries. - // See mozilla-mobile/android-components#842 - compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 - } - - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - jvmTarget = "11" - } - } - testOptions { unitTests.all { testLogging { diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/scheduler/PingUploadWorker.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/scheduler/PingUploadWorker.kt index bad9db8a2c..bff7fda5e1 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/scheduler/PingUploadWorker.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/scheduler/PingUploadWorker.kt @@ -95,6 +95,7 @@ class PingUploadWorker(context: Context, params: WorkerParameters) : Worker(cont * * @return The [androidx.work.ListenableWorker.Result] of the computation */ + @OptIn(ExperimentalUnsignedTypes::class) @Suppress("ReturnCount") override fun doWork(): Result { do { diff --git a/samples/android/app/build.gradle b/samples/android/app/build.gradle index e5ecaaa1ed..98bf1dbe34 100644 --- a/samples/android/app/build.gradle +++ b/samples/android/app/build.gradle @@ -31,11 +31,6 @@ android { } } - compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 - } - buildFeatures { viewBinding true } From f571f6a33cd0948328479911ca395bda4c622e0a Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Tue, 13 Jun 2023 00:08:05 -0400 Subject: [PATCH 47/74] Update Linux Dockerfile and install Java 17 --- taskcluster/docker/linux/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/taskcluster/docker/linux/Dockerfile b/taskcluster/docker/linux/Dockerfile index fd5d5ee2d9..e9b5b6f9ed 100644 --- a/taskcluster/docker/linux/Dockerfile +++ b/taskcluster/docker/linux/Dockerfile @@ -4,7 +4,7 @@ # We use this specific version because our decision task also runs on this one. # We also use that same version in decisionlib.py -FROM ubuntu:18.04 +FROM ubuntu:22.04 MAINTAINER Jan-Erik Rediger "janerik@mozilla.com" @@ -50,7 +50,7 @@ ENV \ RUN apt-get update -qq \ && apt-get install -qy --no-install-recommends \ # To compile Android stuff. - openjdk-11-jdk \ + openjdk-17-jdk \ git \ curl \ # Required by symbolstore.py. @@ -70,6 +70,8 @@ RUN apt-get update -qq \ python3-setuptools \ # Required to extract the Android SDK/NDK. unzip \ + # Required to extract tar.bz2 archives. + bzip2 \ # Required by tooltool to extract tar.xz archives. xz-utils \ # Required to unpack compiler From bc6971a6b127d6f26526b7ae239551ee897fd6be Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Tue, 13 Jun 2023 00:22:50 -0400 Subject: [PATCH 48/74] Update CircleCI Android image --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bcfc8f8504..615a8b7610 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -418,7 +418,7 @@ jobs: Lint Android with ktlint and detekt: docker: - - image: cimg/android:2023.02.1 + - image: cimg/android:2023.06-browsers steps: - checkout - android-setup @@ -428,7 +428,7 @@ jobs: Android tests: docker: - - image: cimg/android:2023.02.1 + - image: cimg/android:2023.06-browsers steps: - checkout - skip-if-doc-only From 8a870f01cc74b74a3083cb19e510d5c91c975ebd Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Tue, 13 Jun 2023 00:08:42 -0400 Subject: [PATCH 49/74] Target JVM 17 bytecode --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index eca7966e41..f27e34daa7 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ buildscript { compileSdkVersion: 33, targetSdkVersion: 33, minSdkVersion: 21, - jvmTargetCompatibility: 11, + jvmTargetCompatibility: 17, ] repositories { From 077fa2ed9eeb4ed63fbba826acab6a060e1f07f5 Mon Sep 17 00:00:00 2001 From: Chris H-C Date: Tue, 13 Jun 2023 10:37:26 -0400 Subject: [PATCH 50/74] Update CHANGELOG.md for #2498 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c021378fcc..aad7fa5dac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ [Full changelog](https://github.com/mozilla/glean/compare/v53.0.0...main) +* Android + * Update minimum supported Java bytecode generation to JVM 17 ([#2498](https://github.com/mozilla/glean/pull/2498/)) + # v53.0.0 (2023-06-07) [Full changelog](https://github.com/mozilla/glean/compare/v52.7.0...v53.0.0) From b647737444ed530c54bf7bbaf154ff663b881c95 Mon Sep 17 00:00:00 2001 From: Chris H-C Date: Tue, 13 Jun 2023 10:46:17 -0400 Subject: [PATCH 51/74] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aad7fa5dac..c0177594f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ [Full changelog](https://github.com/mozilla/glean/compare/v53.0.0...main) * Android - * Update minimum supported Java bytecode generation to JVM 17 ([#2498](https://github.com/mozilla/glean/pull/2498/)) + * Update minimum supported Java bytecode generation to 17 ([#2498](https://github.com/mozilla/glean/pull/2498/)) # v53.0.0 (2023-06-07) From bde6a659f20b226acc3dff18bc9e74844c695d61 Mon Sep 17 00:00:00 2001 From: Chris H-C Date: Tue, 13 Jun 2023 10:54:17 -0400 Subject: [PATCH 52/74] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0177594f5..df4e91bc70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ [Full changelog](https://github.com/mozilla/glean/compare/v53.0.0...main) * Android - * Update minimum supported Java bytecode generation to 17 ([#2498](https://github.com/mozilla/glean/pull/2498/)) + * Update minimum supported Java byte code generation to 17 ([#2498](https://github.com/mozilla/glean/pull/2498/)) # v53.0.0 (2023-06-07) From f49d9e424dda9775d49ddaa0d218e1ad12fcdecf Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Tue, 13 Jun 2023 17:35:04 -0400 Subject: [PATCH 53/74] Synchronize Gradle dependencies with AC --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index f27e34daa7..aa171df45f 100644 --- a/build.gradle +++ b/build.gradle @@ -15,8 +15,8 @@ buildscript { coroutines: '1.7.1', jna: '5.13.0', junit: '4.12', - mockito: '3.11.2', - mockwebserver: '4.9.1', // This is different than a-c, but we're fine, it's only tests. + mockito: '5.3.1', + mockwebserver: '4.11.0', // This is different than a-c, but we're fine, it's only tests. kotlin: '1.8.21', robolectric: '4.10.1', rust_android_plugin: '0.9.3', @@ -25,7 +25,7 @@ buildscript { androidx_annotation: '1.6.0', androidx_appcompat: '1.6.1', androidx_browser: '1.5.0', - androidx_core: '1.10.0', + androidx_core: '1.10.1', androidx_espresso: '3.5.1', androidx_junit: '1.1.5', androidx_lifecycle: '2.6.1', From 0f42deafb30584d00edcf5a51d6832e062712fd9 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Thu, 15 Jun 2023 16:37:18 +0200 Subject: [PATCH 54/74] Python: Avoid variable shadowing to avoid type confusion --- glean-core/python/glean/metrics/datetime.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/glean-core/python/glean/metrics/datetime.py b/glean-core/python/glean/metrics/datetime.py index ccff863bf4..0fd42b263b 100644 --- a/glean-core/python/glean/metrics/datetime.py +++ b/glean-core/python/glean/metrics/datetime.py @@ -99,19 +99,19 @@ def test_get_value( Returns: value (datetime.datetime): value of the stored metric. """ - dt = self._inner.test_get_value(ping_name) - if not dt: + value = self._inner.test_get_value(ping_name) + if not value: return None - tz = tzoffset(dt.offset_seconds) + tz = tzoffset(value.offset_seconds) dt = datetime.datetime( - year=dt.year, - month=dt.month, - day=dt.day, - hour=dt.hour, - minute=dt.minute, - second=dt.second, - microsecond=round(dt.nanosecond / 1000), + year=value.year, + month=value.month, + day=value.day, + hour=value.hour, + minute=value.minute, + second=value.second, + microsecond=round(value.nanosecond / 1000), tzinfo=tz, ) return dt From e8b925ab09ccbb3ab5f9f5c6a262ba4ceed5ec21 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Thu, 15 Jun 2023 20:58:52 -0400 Subject: [PATCH 55/74] Update detekt to version 1.23.0 --- build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index aa171df45f..e97fb2a9af 100644 --- a/build.gradle +++ b/build.gradle @@ -65,7 +65,7 @@ buildscript { } plugins { - id("io.gitlab.arturbosch.detekt").version("1.19.0") + id("io.gitlab.arturbosch.detekt").version("1.23.0") } allprojects { @@ -181,7 +181,6 @@ subprojects { detekt { input = files("${projectDir}/glean-core", "${projectDir}/samples/android", "buildSrc") - failFast = false config = files("${projectDir}/.detekt.yml") buildUponDefaultConfig = true reports { From 4f8c7124bee5bc61ac7c6c028486de7aa77a3f70 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Thu, 15 Jun 2023 21:14:14 -0400 Subject: [PATCH 56/74] Fix InvalidPackageDeclaration errors --- .../org/mozilla/samples/{glean => gleancore}/GleanApplication.kt | 0 .../java/org/mozilla/samples/{glean => gleancore}/MainActivity.kt | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename samples/android/app/src/main/java/org/mozilla/samples/{glean => gleancore}/GleanApplication.kt (100%) rename samples/android/app/src/main/java/org/mozilla/samples/{glean => gleancore}/MainActivity.kt (100%) diff --git a/samples/android/app/src/main/java/org/mozilla/samples/glean/GleanApplication.kt b/samples/android/app/src/main/java/org/mozilla/samples/gleancore/GleanApplication.kt similarity index 100% rename from samples/android/app/src/main/java/org/mozilla/samples/glean/GleanApplication.kt rename to samples/android/app/src/main/java/org/mozilla/samples/gleancore/GleanApplication.kt diff --git a/samples/android/app/src/main/java/org/mozilla/samples/glean/MainActivity.kt b/samples/android/app/src/main/java/org/mozilla/samples/gleancore/MainActivity.kt similarity index 100% rename from samples/android/app/src/main/java/org/mozilla/samples/glean/MainActivity.kt rename to samples/android/app/src/main/java/org/mozilla/samples/gleancore/MainActivity.kt From 8ce88c84be47909457a1bf8c4cd6058b755c4c5d Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Thu, 15 Jun 2023 23:00:12 -0400 Subject: [PATCH 57/74] Fix UseCheckOrError errors --- .../telemetry/glean/private/LabeledMetricType.kt | 12 +++--------- .../java/mozilla/telemetry/glean/private/PingType.kt | 4 +++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/private/LabeledMetricType.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/private/LabeledMetricType.kt index f5dfed24b9..aca8f9be34 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/private/LabeledMetricType.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/private/LabeledMetricType.kt @@ -48,9 +48,7 @@ class LabeledMetricType( is CounterMetricType -> LabeledCounter(meta, labels?.toList()) is BooleanMetricType -> LabeledBoolean(meta, labels?.toList()) is StringMetricType -> LabeledString(meta, labels?.toList()) - else -> throw IllegalStateException( - "Can not create a labeled version of this metric type" - ) + else -> error("Can not create a labeled version of this metric type") } } @@ -77,9 +75,7 @@ class LabeledMetricType( is LabeledCounter -> this.inner.get(label) as T is LabeledBoolean -> this.inner.get(label) as T is LabeledString -> this.inner.get(label) as T - else -> throw IllegalStateException( - "Can not create a labeled version of this metric type" - ) + else -> error("Can not create a labeled version of this metric type") } } @@ -116,9 +112,7 @@ class LabeledMetricType( is LabeledCounter -> this.inner.testGetNumRecordedErrors(errorType) is LabeledBoolean -> this.inner.testGetNumRecordedErrors(errorType) is LabeledString -> this.inner.testGetNumRecordedErrors(errorType) - else -> throw IllegalStateException( - "Can not create a labeled version of this metric type" - ) + else -> error("Can not create a labeled version of this metric type") } } } diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/private/PingType.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/private/PingType.kt index 66615e3180..83e79d4312 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/private/PingType.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/private/PingType.kt @@ -17,7 +17,9 @@ import mozilla.telemetry.glean.internal.PingType as GleanPingType * This is automatically implemented for generated enums. */ interface ReasonCode { - fun code(): Int = throw IllegalStateException("can't determine reason code") + fun code(): Int { + error("can't determine reason code") + } } /** From 33caf76c1037097fcb3f484921327a0682d091ad Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Fri, 16 Jun 2023 16:12:59 -0400 Subject: [PATCH 58/74] Update ktlint to version 0.49.1 --- build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e97fb2a9af..010ec5dbce 100644 --- a/build.gradle +++ b/build.gradle @@ -200,7 +200,7 @@ configurations { } dependencies { - ktlint("com.pinterest:ktlint:0.45.1") { + ktlint("com.pinterest:ktlint:0.49.1") { attributes { attribute(Bundling.BUNDLING_ATTRIBUTE, getObjects().named(Bundling, Bundling.EXTERNAL)) } @@ -219,6 +219,7 @@ task ktlintFormat(type: JavaExec, group: "formatting") { classpath = configurations.ktlint mainClass.set("com.pinterest.ktlint.Main") args "-F", "${projectDir}/glean-core/**/*.kt", "${projectDir}/samples/android/**/*.kt", "buildSrc/**/*.kt", "!**/build/**" + jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED") // workaround for java.lang.ExceptionInInitializerError } // Extremely unsophisticated way to publish a local development version while hiding implementation details. From 00e22288040c8a14b4dcbf94a8eee9210757c476 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Fri, 16 Jun 2023 16:21:50 -0400 Subject: [PATCH 59/74] Run ktlintFormat --- .../mozilla/telemetry/glean/Dispatchers.kt | 4 +- .../java/mozilla/telemetry/glean/Glean.kt | 14 +- .../telemetry/glean/config/Configuration.kt | 2 +- .../glean/debug/GleanDebugActivity.kt | 9 +- .../telemetry/glean/net/BaseUploader.kt | 2 +- .../glean/net/HttpURLConnectionUploader.kt | 5 +- .../private/CustomDistributionMetricType.kt | 2 +- .../glean/private/EventMetricType.kt | 2 +- .../glean/private/LabeledMetricType.kt | 4 +- .../telemetry/glean/private/PingType.kt | 6 +- .../glean/scheduler/MetricsPingScheduler.kt | 14 +- .../glean/scheduler/PingUploadWorker.kt | 4 +- .../glean/testing/GleanTestLocalServer.kt | 2 +- .../telemetry/glean/testing/GleanTestRule.kt | 4 +- .../telemetry/glean/utils/DateUtils.kt | 12 +- .../java/mozilla/telemetry/glean/GleanTest.kt | 136 +++++++++--------- .../java/mozilla/telemetry/glean/TestUtil.kt | 23 +-- .../glean/debug/GleanDebugActivityTest.kt | 45 +++--- .../net/HttpURLConnectionUploaderTest.kt | 14 +- .../telemetry/glean/pings/CustomPingTest.kt | 28 ++-- .../telemetry/glean/pings/DeletionPingTest.kt | 15 +- .../AccumulationsBeforeGleanInitTest.kt | 6 +- .../glean/private/BooleanMetricTypeTest.kt | 16 +-- .../glean/private/CounterMetricTypeTest.kt | 22 +-- .../CustomDistributionMetricTypeTest.kt | 14 +- .../glean/private/DatetimeMetricTypeTest.kt | 10 +- .../glean/private/EventMetricTypeTest.kt | 78 +++++----- .../glean/private/LabeledMetricTypeTest.kt | 108 +++++++------- .../MemoryDistributionMetricTypeTest.kt | 14 +- .../telemetry/glean/private/PingTypeTest.kt | 50 +++---- .../glean/private/QuantityMetricTypeTest.kt | 28 ++-- .../glean/private/RateMetricTypeTest.kt | 18 +-- .../glean/private/StringListMetricTypeTest.kt | 28 ++-- .../glean/private/StringMetricTypeTest.kt | 22 +-- .../glean/private/TimespanMetricTypeTest.kt | 32 ++--- .../TimingDistributionMetricTypeTest.kt | 26 ++-- .../glean/private/UrlMetricTypeTest.kt | 22 +-- .../glean/private/UuidMetricTypeTest.kt | 18 +-- .../scheduler/MetricsPingSchedulerTest.kt | 132 +++++++++-------- .../glean/scheduler/PingUploadWorkerTest.kt | 4 +- .../telemetry/glean/utils/DateUtilsTest.kt | 18 +-- .../telemetry/glean/utils/KArgumentCaptor.kt | 3 +- .../gleancore/pings/SharedTestUtils.kt | 2 +- .../samples/gleancore/GleanApplication.kt | 2 +- 44 files changed, 528 insertions(+), 492 deletions(-) diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/Dispatchers.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/Dispatchers.kt index f2d1076a09..a449a2cd28 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/Dispatchers.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/Dispatchers.kt @@ -56,7 +56,7 @@ internal object Dispatchers { @OptIn(kotlinx.coroutines.DelicateCoroutinesApi::class) var API = WaitableCoroutineScope( CoroutineScope( - newSingleThreadContext("GleanAPIPool") + supervisorJob - ) + newSingleThreadContext("GleanAPIPool") + supervisorJob, + ), ) } diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt index 3a094bed73..26dc512d67 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt @@ -172,7 +172,7 @@ open class GleanInternalAPI internal constructor() { applicationContext: Context, uploadEnabled: Boolean, configuration: Configuration = Configuration(), - buildInfo: BuildInfo + buildInfo: BuildInfo, ) { configuration.dataPath?.let { safeDataPath -> // When the `dataPath` is provided, we need to make sure: @@ -185,7 +185,7 @@ open class GleanInternalAPI internal constructor() { Log.e( LOG_TAG, "Attempted to initialize Glean with an invalid database path " + - "\"{context.applicationInfo.dataDir}/glean_data\" is reserved" + "\"{context.applicationInfo.dataDir}/glean_data\" is reserved", ) return } @@ -213,7 +213,7 @@ open class GleanInternalAPI internal constructor() { if (!isMainProcess(applicationContext)) { Log.e( LOG_TAG, - "Attempted to initialize Glean on a process other than the main process without a dataPath" + "Attempted to initialize Glean on a process other than the main process without a dataPath", ) return } @@ -246,7 +246,7 @@ open class GleanInternalAPI internal constructor() { useCoreMps = false, trimDataToRegisteredPings = false, logLevel = configuration.logLevel, - rateLimit = null + rateLimit = null, ) val clientInfo = getClientInfo(configuration, buildInfo) val callbacks = OnGleanEventsImpl(this@GleanInternalAPI) @@ -304,7 +304,7 @@ open class GleanInternalAPI internal constructor() { fun setExperimentActive( experimentId: String, branch: String, - extra: Map? = null + extra: Map? = null, ) { var map = extra ?: mapOf() gleanSetExperimentActive(experimentId, branch, map) @@ -361,7 +361,7 @@ open class GleanInternalAPI internal constructor() { // https://developer.android.com/reference/android/os/Build deviceManufacturer = Build.MANUFACTURER, deviceModel = Build.MODEL, - locale = getLocaleTag() + locale = getLocaleTag(), ) } @@ -526,7 +526,7 @@ open class GleanInternalAPI internal constructor() { context: Context, config: Configuration, clearStores: Boolean, - uploadEnabled: Boolean = true + uploadEnabled: Boolean = true, ) { isMainProcess = null diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/config/Configuration.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/config/Configuration.kt index dc76b152ac..5288b846ca 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/config/Configuration.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/config/Configuration.kt @@ -30,7 +30,7 @@ data class Configuration @JvmOverloads constructor( // to change in the public constructor below. val httpClient: PingUploader = HttpURLConnectionUploader(), val dataPath: String? = null, - val logLevel: LevelFilter? = null + val logLevel: LevelFilter? = null, ) { companion object { /** diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/debug/GleanDebugActivity.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/debug/GleanDebugActivity.kt index f237419864..4a526e0500 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/debug/GleanDebugActivity.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/debug/GleanDebugActivity.kt @@ -31,10 +31,12 @@ class GleanDebugActivity : Activity() { * Sends the ping with the given name immediately */ const val SEND_PING_EXTRA_KEY = "sendPing" + /** * If set to `true`, pings are dumped to logcat, defaults to `false`. */ const val LOG_PINGS_EXTRA_KEY = "logPings" + /** * Tags all outgoing pings as debug pings to make them available for real-time validation. * The value must match the pattern `[a-zA-Z0-9-]{1,20}`. @@ -84,8 +86,11 @@ class GleanDebugActivity : Activity() { // Make sure that at least one of the supported commands was used. val supportedCommands = listOf( - SEND_PING_EXTRA_KEY, LOG_PINGS_EXTRA_KEY, NEXT_ACTIVITY_TO_RUN, - TAG_DEBUG_VIEW_EXTRA_KEY, SOURCE_TAGS_KEY + SEND_PING_EXTRA_KEY, + LOG_PINGS_EXTRA_KEY, + NEXT_ACTIVITY_TO_RUN, + TAG_DEBUG_VIEW_EXTRA_KEY, + SOURCE_TAGS_KEY, ) var nextActivityName: String? = null diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/net/BaseUploader.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/net/BaseUploader.kt index 5a8572f9fd..3cedd71043 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/net/BaseUploader.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/net/BaseUploader.kt @@ -26,7 +26,7 @@ class BaseUploader(d: PingUploader) : PingUploader by d { return upload( url = config.serverEndpoint + path, data = data, - headers = headers + headers = headers, ) } } diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/net/HttpURLConnectionUploader.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/net/HttpURLConnectionUploader.kt index 3d0fc80233..5fa2941990 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/net/HttpURLConnectionUploader.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/net/HttpURLConnectionUploader.kt @@ -21,10 +21,12 @@ import java.net.URL class HttpURLConnectionUploader : PingUploader { companion object { private const val LOG_TAG: String = "glean/HttpConnUploader" + /** * The timeout, in milliseconds, to use when connecting to the server. */ const val DEFAULT_CONNECTION_TIMEOUT = 10000 + /** * The timeout, in milliseconds, to use when reading from the server. */ @@ -117,7 +119,8 @@ class HttpURLConnectionUploader : PingUploader { return connection.responseCode } - @VisibleForTesting @Throws(IOException::class) + @VisibleForTesting + @Throws(IOException::class) internal fun openConnection(url: String): HttpURLConnection { return URL(url).openConnection() as HttpURLConnection } diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/private/CustomDistributionMetricType.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/private/CustomDistributionMetricType.kt index 67274382b0..6ab220c72f 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/private/CustomDistributionMetricType.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/private/CustomDistributionMetricType.kt @@ -30,7 +30,7 @@ class CustomDistributionMetricType( rangeMin: Long, rangeMax: Long, bucketCount: Long, - histogramType: HistogramType + histogramType: HistogramType, ) : HistogramBase { val inner = CustomDistributionMetric(meta, rangeMin, rangeMax, bucketCount, histogramType) diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/private/EventMetricType.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/private/EventMetricType.kt index 5eb17b1157..6baad436a1 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/private/EventMetricType.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/private/EventMetricType.kt @@ -43,7 +43,7 @@ class NoExtras : EventExtras { * data and making sure that limits are enforced. */ class EventMetricType internal constructor( - private var inner: EventMetric + private var inner: EventMetric, ) where ExtraObject : EventExtras { /** * The public constructor used by automatically generated metrics. diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/private/LabeledMetricType.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/private/LabeledMetricType.kt index aca8f9be34..20940f8f8a 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/private/LabeledMetricType.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/private/LabeledMetricType.kt @@ -30,7 +30,7 @@ class LabeledMetricType( name: String, private val labels: Set? = null, private val sendInPings: List, - private val subMetric: T + private val subMetric: T, ) { // The inner labeled metric, from which actual metrics are constructed. private val inner: Any @@ -41,7 +41,7 @@ class LabeledMetricType( name = name, sendInPings = sendInPings, disabled = disabled, - lifetime = lifetime + lifetime = lifetime, ) this.inner = when (subMetric) { diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/private/PingType.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/private/PingType.kt index 83e79d4312..a22ab7964b 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/private/PingType.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/private/PingType.kt @@ -30,7 +30,7 @@ enum class NoReasonCodes( /** * @suppress */ - val value: Int + val value: Int, ) : ReasonCode { // deliberately empty } @@ -48,7 +48,7 @@ class PingType ( name: String, includeClientId: Boolean, sendIfEmpty: Boolean, - val reasonCodes: List + val reasonCodes: List, ) where ReasonCodesEnum : Enum, ReasonCodesEnum : ReasonCode { private var testCallback: ((ReasonCodesEnum?) -> Unit)? = null private val innerPing: GleanPingType @@ -58,7 +58,7 @@ class PingType ( name = name, includeClientId = includeClientId, sendIfEmpty = sendIfEmpty, - reasonCodes = reasonCodes + reasonCodes = reasonCodes, ) } diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/scheduler/MetricsPingScheduler.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/scheduler/MetricsPingScheduler.kt index e9c0948046..6387ceff5c 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/scheduler/MetricsPingScheduler.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/scheduler/MetricsPingScheduler.kt @@ -33,7 +33,7 @@ import java.util.TimerTask internal class MetricsPingScheduler( private val applicationContext: Context, private val buildInfo: BuildInfo, - migratedLastSentDate: String? = null + migratedLastSentDate: String? = null, ) { internal val sharedPreferences: SharedPreferences by lazy { applicationContext.getSharedPreferences(this.javaClass.canonicalName, Context.MODE_PRIVATE) @@ -96,7 +96,7 @@ internal class MetricsPingScheduler( internal fun schedulePingCollection( now: Calendar, sendTheNextCalendarDay: Boolean, - reason: Pings.metricsReasonCodes + reason: Pings.metricsReasonCodes, ) { // Compute how many milliseconds until the next time the metrics ping // needs to collect data. @@ -146,7 +146,7 @@ internal class MetricsPingScheduler( internal fun getMillisecondsUntilDueTime( sendTheNextCalendarDay: Boolean, now: Calendar, - dueHourOfTheDay: Int = DUE_HOUR_OF_THE_DAY + dueHourOfTheDay: Int = DUE_HOUR_OF_THE_DAY, ): Long { val nowInMillis = now.timeInMillis val dueTime = getDueTimeForToday(now, dueHourOfTheDay) @@ -179,7 +179,7 @@ internal class MetricsPingScheduler( @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) internal fun isAfterDueTime( now: Calendar, - dueHourOfTheDay: Int = DUE_HOUR_OF_THE_DAY + dueHourOfTheDay: Int = DUE_HOUR_OF_THE_DAY, ): Boolean { val nowInMillis = now.timeInMillis val dueTime = getDueTimeForToday(now, dueHourOfTheDay) @@ -253,7 +253,7 @@ internal class MetricsPingScheduler( // the right time? This covers (2) Log.i( LOG_TAG, - "The 'metrics' ping is scheduled for immediate collection, ${safeDateToString(now.time)}" + "The 'metrics' ping is scheduled for immediate collection, ${safeDateToString(now.time)}", ) // Since `schedule` is only ever called from Glean.initialize, we need to ensure @@ -286,7 +286,7 @@ internal class MetricsPingScheduler( @Suppress("MaxLineLength") Log.i( LOG_TAG, - "Collecting the 'metrics' ping, now = ${safeDateToString(now.time)}, startup = $startupPing, reason = $reasonString" + "Collecting the 'metrics' ping, now = ${safeDateToString(now.time)}, startup = $startupPing, reason = $reasonString", ) if (startupPing) { // **IMPORTANT** @@ -372,7 +372,7 @@ internal class MetricsPingScheduler( */ internal class MetricsPingTimer( val scheduler: MetricsPingScheduler, - val reason: Pings.metricsReasonCodes + val reason: Pings.metricsReasonCodes, ) : TimerTask() { companion object { private const val LOG_TAG = "glean/MetricsPingTimer" diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/scheduler/PingUploadWorker.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/scheduler/PingUploadWorker.kt index bff7fda5e1..e02b878971 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/scheduler/PingUploadWorker.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/scheduler/PingUploadWorker.kt @@ -63,7 +63,7 @@ class PingUploadWorker(context: Context, params: WorkerParameters) : Worker(cont WorkManager.getInstance(context).enqueueUniqueWork( PING_WORKER_TAG, ExistingWorkPolicy.KEEP, - buildWorkRequest(PING_WORKER_TAG) + buildWorkRequest(PING_WORKER_TAG), ) // Only flush pings immediately if sending to a test endpoint, @@ -110,7 +110,7 @@ class PingUploadWorker(context: Context, params: WorkerParameters) : Worker(cont action.request.path, body, action.request.headers, - Glean.configuration + Glean.configuration, ) // Process the upload response diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/testing/GleanTestLocalServer.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/testing/GleanTestLocalServer.kt index 576df0a080..ee3facf0dc 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/testing/GleanTestLocalServer.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/testing/GleanTestLocalServer.kt @@ -37,7 +37,7 @@ import java.util.concurrent.Executors @VisibleForTesting(otherwise = VisibleForTesting.NONE) class GleanTestLocalServer( val context: Context, - private val localPort: Int + private val localPort: Int, ) : TestWatcher() { /** * Invoked when a test is about to start. diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/testing/GleanTestRule.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/testing/GleanTestRule.kt index 20bf7b5830..8c70753d2b 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/testing/GleanTestRule.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/testing/GleanTestRule.kt @@ -38,7 +38,7 @@ import java.util.Calendar @VisibleForTesting(otherwise = VisibleForTesting.NONE) class GleanTestRule( val context: Context, - val configToUse: Configuration = Configuration() + val configToUse: Configuration = Configuration(), ) : TestWatcher() { /** * Invoked when a test is about to start. @@ -71,7 +71,7 @@ class GleanTestRule( Glean.resetGlean( context = context, config = configToUse, - clearStores = true + clearStores = true, ) } } diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/utils/DateUtils.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/utils/DateUtils.kt index 1dcc29dad6..cc0577c5cd 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/utils/DateUtils.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/utils/DateUtils.kt @@ -21,7 +21,7 @@ internal val DATE_FORMAT_PATTERNS = mapOf( TimeUnit.SECOND to "yyyy-MM-dd'T'HH:mm:ssZ", TimeUnit.MINUTE to "yyyy-MM-dd'T'HH:mmZ", TimeUnit.HOUR to "yyyy-MM-dd'T'HHZ", - TimeUnit.DAY to "yyyy-MM-ddZ" + TimeUnit.DAY to "yyyy-MM-ddZ", ) // A mapping from the length of the date string to the format that would parse @@ -34,7 +34,7 @@ internal val DATE_FORMAT_PATTERN_BY_LENGTH = mapOf( 24 to "yyyy-MM-dd'T'HH:mm:ssZ", 21 to "yyyy-MM-dd'T'HH:mmZ", 18 to "yyyy-MM-dd'T'HHZ", - 15 to "yyyy-MM-ddZ" + 15 to "yyyy-MM-ddZ", ) internal val DATE_FORMAT_PATTERN_VALUES = DATE_FORMAT_PATTERNS.values.toSet() @@ -48,7 +48,7 @@ internal val DATE_FORMAT_PATTERN_VALUES = DATE_FORMAT_PATTERNS.values.toSet() */ internal fun getISOTimeString( date: Date = Date(), - truncateTo: TimeUnit = TimeUnit.MINUTE + truncateTo: TimeUnit = TimeUnit.MINUTE, ): String { val cal = Calendar.getInstance() cal.setTime(date) @@ -64,7 +64,7 @@ internal fun getISOTimeString( */ internal fun getISOTimeString( calendar: Calendar, - truncateTo: TimeUnit = TimeUnit.MINUTE + truncateTo: TimeUnit = TimeUnit.MINUTE, ): String { val dateFormat = SimpleDateFormat(DATE_FORMAT_PATTERNS[truncateTo], Locale.US) dateFormat.setTimeZone(calendar.getTimeZone()) @@ -136,8 +136,8 @@ internal fun calendarToDatetime(cal: Calendar): Datetime { second = cal.get(Calendar.SECOND).toUInt(), nanosecond = AndroidTimeUnit.MILLISECONDS.toNanos(cal.get(Calendar.MILLISECOND).toLong()).toUInt(), offsetSeconds = AndroidTimeUnit.MILLISECONDS.toSeconds( - cal.get(Calendar.ZONE_OFFSET).toLong() + cal.get(Calendar.DST_OFFSET) - ).toInt() + cal.get(Calendar.ZONE_OFFSET).toLong() + cal.get(Calendar.DST_OFFSET), + ).toInt(), ) return dt diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/GleanTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/GleanTest.kt index 0d17166976..78a8f84c27 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/GleanTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/GleanTest.kt @@ -72,8 +72,8 @@ class GleanTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port - ) + serverEndpoint = "http://" + server.hostName + ":" + server.port, + ), ) Glean.handleBackgroundEvent() @@ -96,8 +96,8 @@ class GleanTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port - ) + serverEndpoint = "http://" + server.hostName + ":" + server.port, + ), ) Glean.setDebugViewTag("this-ping-is-tagged") @@ -118,8 +118,8 @@ class GleanTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "string_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) Glean.setUploadEnabled(false) @@ -130,11 +130,13 @@ class GleanTest { @Test fun `test experiments recording`() { Glean.setExperimentActive( - "experiment_test", "branch_a" + "experiment_test", + "branch_a", ) Glean.setExperimentActive( - "experiment_api", "branch_b", - mapOf("test_key" to "value") + "experiment_api", + "branch_b", + mapOf("test_key" to "value"), ) assertTrue(Glean.testIsExperimentActive("experiment_api")) assertTrue(Glean.testIsExperimentActive("experiment_test")) @@ -156,11 +158,13 @@ class GleanTest { Glean.testDestroyGleanHandle() Glean.setExperimentActive( - "experiment_set_preinit", "branch_a" + "experiment_set_preinit", + "branch_a", ) Glean.setExperimentActive( - "experiment_preinit_disabled", "branch_a" + "experiment_preinit_disabled", + "branch_a", ) Glean.setExperimentInactive("experiment_preinit_disabled") @@ -184,17 +188,17 @@ class GleanTest { category = "ui", lifetime = Lifetime.PING, name = "click", - sendInPings = listOf("events") + sendInPings = listOf("events"), ), - allowedExtraKeys = emptyList() + allowedExtraKeys = emptyList(), ) delayMetricsPing(context) resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port - ) + serverEndpoint = "http://" + server.hostName + ":" + server.port, + ), ) // Fake calling the lifecycle observer. @@ -268,7 +272,7 @@ class GleanTest { 2, json.getJSONObject("metrics") .getJSONObject("counter") - .getLong("glean.validation.foreground_count") + .getLong("glean.validation.foreground_count"), ) } } else { @@ -294,9 +298,9 @@ class GleanTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - false + false, ) try { @@ -327,7 +331,7 @@ class GleanTest { // Remove the Glean's data directory. val gleanDir = File( context.applicationInfo.dataDir, - GleanInternalAPI.GLEAN_DATA_DIR + GleanInternalAPI.GLEAN_DATA_DIR, ) assertTrue(gleanDir.deleteRecursively()) @@ -350,8 +354,8 @@ class GleanTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "counter_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Destroy Glean, so that the dispatcher will queue tasks until flushed. @@ -381,7 +385,7 @@ class GleanTest { Glean.initialize( context, true, - buildInfo = GleanBuildInfo.buildInfo + buildInfo = GleanBuildInfo.buildInfo, ) val afterConfig = Glean.configuration @@ -459,8 +463,8 @@ class GleanTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port - ) + serverEndpoint = "http://" + server.hostName + ":" + server.port, + ), ) val pingName = "custom_ping_1" @@ -468,7 +472,7 @@ class GleanTest { name = pingName, includeClientId = true, sendIfEmpty = false, - reasonCodes = listOf() + reasonCodes = listOf(), ) val stringMetric = StringMetricType( CommonMetricData( @@ -476,8 +480,8 @@ class GleanTest { category = "telemetry", lifetime = Lifetime.PING, name = "string_metric", - sendInPings = listOf(pingName) - ) + sendInPings = listOf(pingName), + ), ) // This test relies on testing mode to be disabled, since we need to prove the @@ -521,8 +525,8 @@ class GleanTest { category = "telemetry", lifetime = Lifetime.PING, name = "string_metric", - sendInPings = listOf("default") - ) + sendInPings = listOf("default"), + ), ) stringMetric.set("TEST VALUE") @@ -556,7 +560,7 @@ class GleanTest { Glean.metricsPingScheduler!!.schedulePingCollection( Calendar.getInstance(), true, - Pings.metricsReasonCodes.overdue + Pings.metricsReasonCodes.overdue, ) // Enqueue a worker to send the baseline ping Pings.baseline.submit(Pings.baselineReasonCodes.active) @@ -564,11 +568,11 @@ class GleanTest { // Verify that the workers are enqueued assertTrue( "PingUploadWorker is enqueued", - getWorkerStatus(context, PingUploadWorker.PING_WORKER_TAG).isEnqueued + getWorkerStatus(context, PingUploadWorker.PING_WORKER_TAG).isEnqueued, ) assertTrue( "MetricsPingWorker is enqueued", - Glean.metricsPingScheduler!!.timer != null + Glean.metricsPingScheduler!!.timer != null, ) Glean.setUploadEnabled(true) @@ -578,11 +582,11 @@ class GleanTest { // before initializing glean. assertTrue( "PingUploadWorker is enqueued", - getWorkerStatus(context, PingUploadWorker.PING_WORKER_TAG).isEnqueued + getWorkerStatus(context, PingUploadWorker.PING_WORKER_TAG).isEnqueued, ) assertTrue( "MetricsPingWorker is enqueued", - Glean.metricsPingScheduler!!.timer != null + Glean.metricsPingScheduler!!.timer != null, ) // Toggle upload enabled to false @@ -591,7 +595,7 @@ class GleanTest { // Verify workers have been cancelled assertTrue( "MetricsPingWorker is not enqueued", - Glean.metricsPingScheduler!!.timer == null + Glean.metricsPingScheduler!!.timer == null, ) } @@ -613,7 +617,7 @@ class GleanTest { Glean.initialize( context, true, - buildInfo = GleanBuildInfo.buildInfo + buildInfo = GleanBuildInfo.buildInfo, ) } } @@ -633,8 +637,8 @@ class GleanTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "repeatedly", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) repeat(1010) { @@ -645,10 +649,10 @@ class GleanTest { resetGlean( context, config = Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), clearStores = false, - uploadEnabled = true + uploadEnabled = true, ) Pings.metrics.submit() @@ -666,12 +670,12 @@ class GleanTest { .getJSONObject("counter") assertTrue( "Ping payload: $jsonContent", - 10 <= counters.getInt("glean.error.preinit_tasks_overflow") + 10 <= counters.getInt("glean.error.preinit_tasks_overflow"), ) assertEquals( "Ping payload: $jsonContent", 1000, - counters.getInt("telemetry.repeatedly") + counters.getInt("telemetry.repeatedly"), ) } @@ -681,18 +685,18 @@ class GleanTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - uploadEnabled = true + uploadEnabled = true, ) resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), uploadEnabled = false, - clearStores = false + clearStores = false, ) // Now trigger it to upload @@ -709,18 +713,18 @@ class GleanTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - uploadEnabled = false + uploadEnabled = false, ) resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), uploadEnabled = false, - clearStores = false + clearStores = false, ) assertEquals(0, server.requestCount) @@ -737,8 +741,8 @@ class GleanTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "app_lifetime", - sendInPings = listOf("baseline") - ) + sendInPings = listOf("baseline"), + ), ) stringMetric.set("HELLOOOOO!") @@ -749,9 +753,9 @@ class GleanTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - clearStores = false + clearStores = false, ) try { @@ -782,7 +786,7 @@ class GleanTest { val context: Context = ApplicationProvider.getApplicationContext() val server = getMockWebServer() val config = Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ) Glean.setDebugViewTag("valid-tag") @@ -833,7 +837,7 @@ class GleanTest { name = pingName, includeClientId = true, sendIfEmpty = false, - reasonCodes = listOf() + reasonCodes = listOf(), ) val stringMetric = StringMetricType( CommonMetricData( @@ -841,13 +845,13 @@ class GleanTest { category = "telemetry", lifetime = Lifetime.PING, name = "string_metric", - sendInPings = listOf(pingName) - ) + sendInPings = listOf(pingName), + ), ) val server = getMockWebServer() val config = Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ) Glean.initialize(context, true, config, GleanBuildInfo.buildInfo) @@ -878,7 +882,9 @@ class GleanTest { val buildDate = Calendar.getInstance(TimeZone.getTimeZone("GMT+0")) .also { cal -> cal.set(2020, 10, 6, 11, 30, 50) } Glean.initialize( - context, true, buildInfo = BuildInfo(versionName = "foo", versionCode = "c0ffee", buildDate = buildDate) + context, + true, + buildInfo = BuildInfo(versionName = "foo", versionCode = "c0ffee", buildDate = buildDate), ) assertEquals("c0ffee", GleanInternalMetrics.appBuild.testGetValue()) @@ -893,8 +899,8 @@ class GleanTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port - ) + serverEndpoint = "http://" + server.hostName + ":" + server.port, + ), ) Glean.handleBackgroundEvent() @@ -933,7 +939,7 @@ class GleanTest { // Initialize with a custom data path and ensure `isCustomDataPath` is true. Glean.testDestroyGleanHandle() val cfg = Configuration( - dataPath = File(context.applicationInfo.dataDir, "glean_test").absolutePath + dataPath = File(context.applicationInfo.dataDir, "glean_test").absolutePath, ) Glean.initialize(context, true, cfg, buildInfo = GleanBuildInfo.buildInfo) assertTrue(Glean.isCustomDataPath) @@ -964,8 +970,8 @@ class GleanTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "string_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Set a metric configuration which will enable the telemetry.string_metric diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/TestUtil.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/TestUtil.kt index 02d7fabf70..57b460c556 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/TestUtil.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/TestUtil.kt @@ -43,7 +43,7 @@ object GleanBuildInfo { BuildInfo( versionCode = "0.0.1", versionName = "0.0.1", - buildDate = stubBuildDate() + buildDate = stubBuildDate(), ) } } @@ -61,10 +61,11 @@ object GleanBuildInfo { internal fun checkPingSchema(content: JSONObject) { val os = System.getProperty("os.name")?.lowercase() val pythonExecutable = - if (os?.indexOf("win")?.compareTo(0) == 0) + if (os?.indexOf("win")?.compareTo(0) == 0) { "${BuildConfig.GLEAN_MINICONDA_DIR}/python" - else + } else { "${BuildConfig.GLEAN_MINICONDA_DIR}/bin/python" + } val proc = ProcessBuilder( listOf( @@ -73,8 +74,8 @@ internal fun checkPingSchema(content: JSONObject) { "glean_parser", "check", "-s", - "${BuildConfig.GLEAN_PING_SCHEMA_PATH}" - ) + "${BuildConfig.GLEAN_PING_SCHEMA_PATH}", + ), ).redirectOutput(ProcessBuilder.Redirect.INHERIT) .redirectError(ProcessBuilder.Redirect.INHERIT) val process = proc.start() @@ -120,7 +121,7 @@ internal fun resetGlean( config: Configuration = Configuration(), clearStores: Boolean = true, redirectRobolectricLogs: Boolean = true, - uploadEnabled: Boolean = true + uploadEnabled: Boolean = true, ) { if (redirectRobolectricLogs) { ShadowLog.stream = System.out @@ -184,7 +185,7 @@ internal fun getWorkerStatus(context: Context, tag: String): WorkerStatus { internal fun waitForEnqueuedWorker( context: Context, workTag: String, - timeoutMillis: Long = 5000 + timeoutMillis: Long = 5000, ) = runBlocking { withTimeout(timeoutMillis) { do { @@ -208,7 +209,7 @@ internal fun triggerWorkManager(context: Context) { val status = getWorkerStatus(context, workerTag) Assert.assertTrue( "A scheduled $workerTag must exist", - status.isEnqueued + status.isEnqueued, ) // Trigger WorkManager using TestDriver @@ -261,8 +262,8 @@ internal fun delayMetricsPing( buildInfo: BuildInfo = BuildInfo( versionCode = "0.0.1", versionName = "0.0.1", - buildDate = stubBuildDate() - ) + buildDate = stubBuildDate(), + ), ) { // Set the current system time to a known datetime. val fakeNow = Calendar.getInstance() @@ -323,7 +324,7 @@ fun waitForPingContent( pingName: String, pingReason: String?, server: MockWebServer, - maxAttempts: Int = 3 + maxAttempts: Int = 3, ): JSONObject? { var parsedPayload: JSONObject? = null @Suppress("LoopWithTooManyJumpStatements") diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/debug/GleanDebugActivityTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/debug/GleanDebugActivityTest.kt index 19eb55f8a5..300dcf35d0 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/debug/GleanDebugActivityTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/debug/GleanDebugActivityTest.kt @@ -79,7 +79,7 @@ class GleanDebugActivityTest { // Build the intent that will call our debug activity, with no extra. val intent = Intent( ApplicationProvider.getApplicationContext(), - GleanDebugActivity::class.java + GleanDebugActivity::class.java, ) // Add at least an option, otherwise the activity will be removed. intent.putExtra(GleanDebugActivity.LOG_PINGS_EXTRA_KEY, true) @@ -96,7 +96,6 @@ class GleanDebugActivityTest { } } - @Test // TODO(jer): can we make this actually test something? // What we would want to do is really just the // "a custom activity is correctly started" test below: @@ -104,6 +103,7 @@ class GleanDebugActivityTest { // Even when Glean is not initialized we want the debug activity to run through, // not crash and just work. // If Glean is initialized later it should still trigger the debug activity tasks. + @Test fun `it works without Glean initialized`() { // Destroy Glean. Launching the Debug Activity should only schedule tasks, // so they run once Glean is initialized. @@ -112,7 +112,7 @@ class GleanDebugActivityTest { // Set the extra values and start the intent. val intent = Intent( ApplicationProvider.getApplicationContext(), - GleanDebugActivity::class.java + GleanDebugActivity::class.java, ) intent.putExtra(GleanDebugActivity.SEND_PING_EXTRA_KEY, "metrics") launch(intent) @@ -136,8 +136,8 @@ class GleanDebugActivityTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "boolean_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) booleanMetric.set(true) @@ -145,13 +145,13 @@ class GleanDebugActivityTest { // Set the extra values and start the intent. val intent = Intent( ApplicationProvider.getApplicationContext(), - GleanDebugActivity::class.java + GleanDebugActivity::class.java, ) intent.putExtra(GleanDebugActivity.SEND_PING_EXTRA_KEY, "metrics") launch(intent) val config = Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ) resetGlean(context, config) @@ -164,7 +164,7 @@ class GleanDebugActivityTest { val request = server.takeRequest(10L, TimeUnit.SECONDS)!! assertTrue( - request.requestUrl!!.encodedPath.startsWith("/submit/mozilla-telemetry-glean-test/metrics") + request.requestUrl!!.encodedPath.startsWith("/submit/mozilla-telemetry-glean-test/metrics"), ) server.shutdown() @@ -178,8 +178,8 @@ class GleanDebugActivityTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port - ) + serverEndpoint = "http://" + server.hostName + ":" + server.port, + ), ) // Put some metric data in the store, otherwise we won't get a ping out @@ -190,8 +190,8 @@ class GleanDebugActivityTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "boolean_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) booleanMetric.set(true) @@ -200,7 +200,7 @@ class GleanDebugActivityTest { // Set the extra values and start the intent. val intent = Intent( ApplicationProvider.getApplicationContext(), - GleanDebugActivity::class.java + GleanDebugActivity::class.java, ) intent.putExtra(GleanDebugActivity.SEND_PING_EXTRA_KEY, "metrics") intent.putExtra(GleanDebugActivity.TAG_DEBUG_VIEW_EXTRA_KEY, "inv@lid_id") @@ -210,7 +210,8 @@ class GleanDebugActivityTest { // has happened. assertEquals( "Server endpoint must be reset if tag didn't pass regex", - "http://" + server.hostName + ":" + server.port, Glean.configuration.serverEndpoint + "http://" + server.hostName + ":" + server.port, + Glean.configuration.serverEndpoint, ) triggerWorkManager(context) @@ -218,7 +219,7 @@ class GleanDebugActivityTest { assertTrue( "Request path must be correct", - request.requestUrl!!.encodedPath.startsWith("/submit/mozilla-telemetry-glean-test/metrics") + request.requestUrl!!.encodedPath.startsWith("/submit/mozilla-telemetry-glean-test/metrics"), ) // resetGlean doesn't actually reset the debug view tag, @@ -237,8 +238,8 @@ class GleanDebugActivityTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port - ) + serverEndpoint = "http://" + server.hostName + ":" + server.port, + ), ) // Create a custom ping for testing. Since we're testing headers, @@ -247,13 +248,13 @@ class GleanDebugActivityTest { name = "custom", includeClientId = false, sendIfEmpty = true, - reasonCodes = listOf() + reasonCodes = listOf(), ) // Set the extra values and start the intent. val intent = Intent( ApplicationProvider.getApplicationContext(), - GleanDebugActivity::class.java + GleanDebugActivity::class.java, ) intent.putExtra(GleanDebugActivity.SEND_PING_EXTRA_KEY, "metrics") intent.putExtra(GleanDebugActivity.SOURCE_TAGS_KEY, testTags.toTypedArray()) @@ -271,7 +272,7 @@ class GleanDebugActivityTest { assertTrue( "Request path must be correct", - request.requestUrl!!.encodedPath.startsWith("/submit/mozilla-telemetry-glean-test") + request.requestUrl!!.encodedPath.startsWith("/submit/mozilla-telemetry-glean-test"), ) assertEquals(expectedTags, request.headers.get("X-Source-Tags")) @@ -286,7 +287,7 @@ class GleanDebugActivityTest { // Build the intent that will call our debug activity, with no extra. val intent = Intent( ApplicationProvider.getApplicationContext(), - GleanDebugActivity::class.java + GleanDebugActivity::class.java, ) // Add at least an option, otherwise the activity will be removed. intent.putExtra(GleanDebugActivity.NEXT_ACTIVITY_TO_RUN, "OtherActivity") @@ -310,7 +311,7 @@ class GleanDebugActivityTest { // Build the intent that will call our debug activity, with no extra. val intent = Intent( ApplicationProvider.getApplicationContext(), - GleanDebugActivity::class.java + GleanDebugActivity::class.java, ) // Add at least an option, otherwise the activity will be removed. intent.putExtra(GleanDebugActivity.NEXT_ACTIVITY_TO_RUN, "HiddenActivity") diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/net/HttpURLConnectionUploaderTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/net/HttpURLConnectionUploaderTest.kt index d8e14db317..3a94b7c531 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/net/HttpURLConnectionUploaderTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/net/HttpURLConnectionUploaderTest.kt @@ -62,7 +62,7 @@ class HttpURLConnectionUploaderTest { val expectedHeaders = mapOf( "Content-Type" to "application/json; charset=utf-8", "Test-header" to "SomeValue", - "OtherHeader" to "Glean/Test 25.0.2" + "OtherHeader" to "Glean/Test 25.0.2", ) uploader.upload(testPath, testPing.toByteArray(Charsets.UTF_8), expectedHeaders) @@ -70,7 +70,7 @@ class HttpURLConnectionUploaderTest { val headerValueCaptor = argumentCaptor() verify(connection, times(expectedHeaders.size)).setRequestProperty( headerNameCaptor.capture(), - headerValueCaptor.capture() + headerValueCaptor.capture(), ) val capturedHeader = headerNameCaptor.allValues.zip(headerValueCaptor.allValues) @@ -78,12 +78,12 @@ class HttpURLConnectionUploaderTest { assertEquals( "Header names must be correctly reported", capturedHeader[index].first, - header.first + header.first, ) assertEquals( "Header values must be correctly reported", capturedHeader[index].second, - header.second + header.second, ) } } @@ -100,7 +100,7 @@ class HttpURLConnectionUploaderTest { assertEquals( client.upload(testPath, testPing.toByteArray(Charsets.UTF_8), emptyMap()), - HttpStatus(200) + HttpStatus(200), ) verify(connection, times(1)).disconnect() } @@ -111,7 +111,7 @@ class HttpURLConnectionUploaderTest { server.enqueue(MockResponse().setBody("OK")) val testConfig = testDefaultConfig.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ) val client = HttpURLConnectionUploader() @@ -139,7 +139,7 @@ class HttpURLConnectionUploaderTest { server.enqueue(MockResponse().setBody("OK")) val testConfig = testDefaultConfig.copy( - serverEndpoint = "http://localhost:" + server.port + serverEndpoint = "http://localhost:" + server.port, ) // Set the default cookie manager/handler to be used for the http upload. diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/pings/CustomPingTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/pings/CustomPingTest.kt index 9a2708e7ce..2ff64f08d1 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/pings/CustomPingTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/pings/CustomPingTest.kt @@ -66,9 +66,10 @@ class CustomPingTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - clearStores = true, uploadEnabled = true + clearStores = true, + uploadEnabled = true, ) // Define a new custom ping inline. @@ -76,7 +77,7 @@ class CustomPingTest { name = "custom-ping", includeClientId = true, sendIfEmpty = true, - reasonCodes = emptyList() + reasonCodes = emptyList(), ) customPing.submit() @@ -93,9 +94,10 @@ class CustomPingTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - clearStores = true, uploadEnabled = true + clearStores = true, + uploadEnabled = true, ) // Define a new custom ping inline. @@ -103,7 +105,7 @@ class CustomPingTest { name = "custom-ping", includeClientId = true, sendIfEmpty = true, - reasonCodes = emptyList() + reasonCodes = emptyList(), ) // Trigger the ping twice. @@ -142,9 +144,10 @@ class CustomPingTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - clearStores = true, uploadEnabled = true + clearStores = true, + uploadEnabled = true, ) val pingName = "custom-events-1" @@ -158,7 +161,7 @@ class CustomPingTest { name = "click", sendInPings = listOf(pingName), ), - allowedExtraKeys = emptyList() + allowedExtraKeys = emptyList(), ) // and record it in the currently initialized Glean instance. click.record(NoExtras()) @@ -174,16 +177,17 @@ class CustomPingTest { name = pingName, includeClientId = true, sendIfEmpty = false, - reasonCodes = emptyList() + reasonCodes = emptyList(), ) // This is equivalent to a consumer calling `Glean.initialize` at startup resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - clearStores = false, uploadEnabled = true + clearStores = false, + uploadEnabled = true, ) // There should be no ping upload worker, diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/pings/DeletionPingTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/pings/DeletionPingTest.kt index 5cb940b989..ef95d34161 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/pings/DeletionPingTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/pings/DeletionPingTest.kt @@ -63,9 +63,10 @@ class DeletionPingTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - clearStores = true, uploadEnabled = false + clearStores = true, + uploadEnabled = false, ) triggerWorkManager(context) @@ -82,9 +83,10 @@ class DeletionPingTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - clearStores = true, uploadEnabled = true + clearStores = true, + uploadEnabled = true, ) // Get directory for pending deletion-request pings @@ -140,9 +142,10 @@ class DeletionPingTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - clearStores = true, uploadEnabled = false + clearStores = true, + uploadEnabled = false, ) triggerWorkManager(context) diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/AccumulationsBeforeGleanInitTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/AccumulationsBeforeGleanInitTest.kt index 509f303c16..b3969b20a9 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/AccumulationsBeforeGleanInitTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/AccumulationsBeforeGleanInitTest.kt @@ -48,8 +48,8 @@ class AccumulationsBeforeGleanInitTest { category = "test.telemetry", lifetime = Lifetime.APPLICATION, name = "pre_init_counter", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val labeledCounterMetric = LabeledMetricType( @@ -58,7 +58,7 @@ class AccumulationsBeforeGleanInitTest { lifetime = Lifetime.APPLICATION, name = "pre_init_counter", sendInPings = listOf("metrics"), - subMetric = counterMetric + subMetric = counterMetric, ) labeledCounterMetric["label1"].add(1) diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/BooleanMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/BooleanMetricTypeTest.kt index 8f763a0c60..22a90151d6 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/BooleanMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/BooleanMetricTypeTest.kt @@ -35,8 +35,8 @@ class BooleanMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "boolean_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Record two booleans of the same type, with a little delay. @@ -59,8 +59,8 @@ class BooleanMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "booleanMetric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Attempt to store the boolean. @@ -79,8 +79,8 @@ class BooleanMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "booleanMetric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) assertNull(booleanMetric.testGetValue()) } @@ -94,8 +94,8 @@ class BooleanMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "boolean_metric", - sendInPings = listOf("store1", "store2") - ) + sendInPings = listOf("store1", "store2"), + ), ) // Record two booleans of the same type, with a little delay. diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/CounterMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/CounterMetricTypeTest.kt index 5d82c01db9..4a68860405 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/CounterMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/CounterMetricTypeTest.kt @@ -35,8 +35,8 @@ class CounterMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "counter_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) assertNull(counterMetric.testGetValue()) @@ -64,8 +64,8 @@ class CounterMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "counter_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Attempt to store the counter. @@ -73,7 +73,7 @@ class CounterMetricTypeTest { // Check that nothing was recorded. assertNull( "Counters must not be recorded if they are disabled", - counterMetric.testGetValue() + counterMetric.testGetValue(), ) } @@ -85,8 +85,8 @@ class CounterMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "counter_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) assertNull(counterMetric.testGetValue()) } @@ -100,8 +100,8 @@ class CounterMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "counter_metric", - sendInPings = listOf("store1", "store2") - ) + sendInPings = listOf("store1", "store2"), + ), ) // Add to the counter a couple of times with a little delay. The first call will check @@ -126,8 +126,8 @@ class CounterMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "counter_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Increment to 1 (initial value) diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/CustomDistributionMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/CustomDistributionMetricTypeTest.kt index 8847b11f0b..fbe5ad69e7 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/CustomDistributionMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/CustomDistributionMetricTypeTest.kt @@ -36,7 +36,7 @@ class CustomDistributionMetricTypeTest { rangeMin = 0L, rangeMax = 60000L, bucketCount = 100, - histogramType = HistogramType.EXPONENTIAL + histogramType = HistogramType.EXPONENTIAL, ) // Accumulate a few values @@ -71,7 +71,7 @@ class CustomDistributionMetricTypeTest { rangeMin = 0L, rangeMax = 60000L, bucketCount = 100, - histogramType = HistogramType.EXPONENTIAL + histogramType = HistogramType.EXPONENTIAL, ) // Attempt to store to the distribution @@ -80,7 +80,7 @@ class CustomDistributionMetricTypeTest { // Check that nothing was recorded. assertNull( "Disabled CustomDistributions should not record data.", - metric.testGetValue() + metric.testGetValue(), ) } @@ -98,7 +98,7 @@ class CustomDistributionMetricTypeTest { rangeMin = 0L, rangeMax = 60000L, bucketCount = 100, - histogramType = HistogramType.EXPONENTIAL + histogramType = HistogramType.EXPONENTIAL, ) assertNull(metric.testGetValue()) } @@ -117,7 +117,7 @@ class CustomDistributionMetricTypeTest { rangeMin = 0L, rangeMax = 60000L, bucketCount = 100, - histogramType = HistogramType.EXPONENTIAL + histogramType = HistogramType.EXPONENTIAL, ) // Accumulate a few values @@ -160,7 +160,7 @@ class CustomDistributionMetricTypeTest { rangeMin = 0L, rangeMax = 60000L, bucketCount = 100, - histogramType = HistogramType.EXPONENTIAL + histogramType = HistogramType.EXPONENTIAL, ) // Accumulate a few values @@ -193,7 +193,7 @@ class CustomDistributionMetricTypeTest { rangeMin = 0L, rangeMax = 60000L, bucketCount = 100, - histogramType = HistogramType.EXPONENTIAL + histogramType = HistogramType.EXPONENTIAL, ) // Accumulate a few values diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/DatetimeMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/DatetimeMetricTypeTest.kt index e0fb9b237c..48f335d63d 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/DatetimeMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/DatetimeMetricTypeTest.kt @@ -40,8 +40,8 @@ class DatetimeMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "datetime_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) val value = Calendar.getInstance() @@ -84,8 +84,8 @@ class DatetimeMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "datetimeMetric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Attempt to store the datetime. @@ -106,7 +106,7 @@ class DatetimeMetricTypeTest { name = "datetimeMetric", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.MILLISECOND + timeUnit = TimeUnit.MILLISECOND, ) val nowDate = Date() diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/EventMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/EventMetricTypeTest.kt index 6a8456b0dd..50c2385b8f 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/EventMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/EventMetricTypeTest.kt @@ -93,7 +93,7 @@ class EventMetricTypeTest { name = "click", sendInPings = listOf("store1"), ), - allowedExtraKeys = listOf("object_id", "other") + allowedExtraKeys = listOf("object_id", "other"), ) // Record two events of the same type, with a little delay. @@ -121,7 +121,7 @@ class EventMetricTypeTest { assertTrue( "The sequence of the events must be preserved" + ", first: ${firstEvent.timestamp}, second: ${secondEvent.timestamp}", - firstEvent.timestamp <= secondEvent.timestamp + firstEvent.timestamp <= secondEvent.timestamp, ) } @@ -136,7 +136,7 @@ class EventMetricTypeTest { name = "click", sendInPings = listOf("store1"), ), - allowedExtraKeys = listOf("object_id") + allowedExtraKeys = listOf("object_id"), ) // Record two events of the same type, with a little delay. @@ -160,7 +160,7 @@ class EventMetricTypeTest { assertTrue( "The sequence of the events must be preserved" + ", first: ${firstEvent.timestamp}, second: ${secondEvent.timestamp}", - firstEvent.timestamp <= secondEvent.timestamp + firstEvent.timestamp <= secondEvent.timestamp, ) } @@ -174,9 +174,9 @@ class EventMetricTypeTest { category = "ui", lifetime = Lifetime.PING, name = "click", - sendInPings = listOf("store1") + sendInPings = listOf("store1"), ), - allowedExtraKeys = emptyList() + allowedExtraKeys = emptyList(), ) // Attempt to store the event. @@ -185,7 +185,7 @@ class EventMetricTypeTest { // Check that nothing was recorded. assertNull( "Events must not be recorded if they are disabled", - click.testGetValue() + click.testGetValue(), ) } @@ -197,9 +197,9 @@ class EventMetricTypeTest { category = "ui", lifetime = Lifetime.PING, name = "testEvent", - sendInPings = listOf("store1") + sendInPings = listOf("store1"), ), - allowedExtraKeys = emptyList() + allowedExtraKeys = emptyList(), ) assertNull(testEvent.testGetValue()) } @@ -215,7 +215,7 @@ class EventMetricTypeTest { name = "click", sendInPings = listOf("store1", "store2"), ), - allowedExtraKeys = listOf("object_id") + allowedExtraKeys = listOf("object_id"), ) // Record two events of the same type, with a little delay. @@ -241,7 +241,7 @@ class EventMetricTypeTest { assertTrue( "The sequence of the events must be preserved" + ", first: ${firstEvent.timestamp}, second: ${secondEvent.timestamp}", - firstEvent.timestamp <= secondEvent.timestamp + firstEvent.timestamp <= secondEvent.timestamp, ) } @@ -255,7 +255,7 @@ class EventMetricTypeTest { name = "event_metric", sendInPings = listOf("store1"), ), - allowedExtraKeys = listOf("test_name") + allowedExtraKeys = listOf("test_name"), ) Glean.setUploadEnabled(true) eventMetric.record(EventMetricExtras(testName = "event1")) @@ -279,9 +279,9 @@ class EventMetricTypeTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - clearStores = true + clearStores = true, ) val event = EventMetricType( @@ -292,7 +292,7 @@ class EventMetricTypeTest { lifetime = Lifetime.PING, sendInPings = listOf("events"), ), - allowedExtraKeys = listOf("some_extra") + allowedExtraKeys = listOf("some_extra"), ) event.record(TestEventExtras(someExtra = "bar")) @@ -302,9 +302,9 @@ class EventMetricTypeTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - clearStores = false + clearStores = false, ) triggerWorkManager(context) @@ -313,7 +313,7 @@ class EventMetricTypeTest { assertEquals("POST", request.method) val applicationId = "mozilla-telemetry-glean-test" assert( - request.path!!.startsWith("/submit/$applicationId/events/") + request.path!!.startsWith("/submit/$applicationId/events/"), ) val pingJsonData = request.getPlainBody() val pingJson = JSONObject(pingJsonData) @@ -321,11 +321,11 @@ class EventMetricTypeTest { assertNotNull(pingJson.opt("events")) assertEquals( 1, - pingJson.getJSONArray("events").length() + pingJson.getJSONArray("events").length(), ) assertEquals( "startup", - pingJson.getJSONObject("ping_info").getString("reason") + pingJson.getJSONObject("ping_info").getString("reason"), ) } @@ -340,9 +340,9 @@ class EventMetricTypeTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - clearStores = true + clearStores = true, ) val event = EventMetricType( @@ -353,7 +353,7 @@ class EventMetricTypeTest { lifetime = Lifetime.PING, sendInPings = listOf("events"), ), - allowedExtraKeys = listOf("some_extra") + allowedExtraKeys = listOf("some_extra"), ) // Record an event in the current run. @@ -371,9 +371,9 @@ class EventMetricTypeTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - clearStores = false + clearStores = false, ) event.record(TestEventExtras(someExtra = "post-init")) @@ -389,17 +389,17 @@ class EventMetricTypeTest { assertEquals( "Ping payload: $pingJson", "startup", - pingJson.getJSONObject("ping_info").getString("reason") + pingJson.getJSONObject("ping_info").getString("reason"), ) assertEquals( "Ping payload: $pingJson", 1, - pingJson.getJSONArray("events").length() + pingJson.getJSONArray("events").length(), ) assertEquals( "Ping payload: $pingJson", "run1", - pingJson.getJSONArray("events").getJSONObject(0).getJSONObject("extra").getString("some_extra") + pingJson.getJSONArray("events").getJSONObject(0).getJSONObject("extra").getString("some_extra"), ) Glean.submitPingByName("events", "inactive") @@ -415,19 +415,19 @@ class EventMetricTypeTest { assertEquals( "Ping payload: $pingJson", "inactive", - pingJson.getJSONObject("ping_info").getString("reason") + pingJson.getJSONObject("ping_info").getString("reason"), ) assertEquals( 2, - pingJson.getJSONArray("events").length() + pingJson.getJSONArray("events").length(), ) assertEquals( "pre-init", - pingJson.getJSONArray("events").getJSONObject(0).getJSONObject("extra").getString("some_extra") + pingJson.getJSONArray("events").getJSONObject(0).getJSONObject("extra").getString("some_extra"), ) assertEquals( "post-init", - pingJson.getJSONArray("events").getJSONObject(1).getJSONObject("extra").getString("some_extra") + pingJson.getJSONArray("events").getJSONObject(1).getJSONObject("extra").getString("some_extra"), ) } @@ -442,7 +442,7 @@ class EventMetricTypeTest { name = "click", sendInPings = listOf("store1"), ), - allowedExtraKeys = listOf("object_id", "other") + allowedExtraKeys = listOf("object_id", "other"), ) val longString = "0123456789".repeat(51) @@ -466,9 +466,9 @@ class EventMetricTypeTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - clearStores = true + clearStores = true, ) val pingName = "another-ping-2" @@ -480,7 +480,7 @@ class EventMetricTypeTest { lifetime = Lifetime.PING, sendInPings = listOf(pingName, "events"), // also send in builtin ping ), - allowedExtraKeys = listOf("some_extra") + allowedExtraKeys = listOf("some_extra"), ) // Let's record a single event. This will be queued up but not be sent. @@ -494,9 +494,9 @@ class EventMetricTypeTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - clearStores = false + clearStores = false, ) // Create and register a ping AFTER Glean.initialize @@ -505,7 +505,7 @@ class EventMetricTypeTest { name = pingName, includeClientId = true, sendIfEmpty = false, - reasonCodes = listOf() + reasonCodes = listOf(), ) // Trigger worker task to upload the pings in the background. diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/LabeledMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/LabeledMetricTypeTest.kt index a10235b3c8..e81a24ae18 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/LabeledMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/LabeledMetricTypeTest.kt @@ -31,8 +31,8 @@ class LabeledMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "labeled_counter_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val labeledCounterMetric = LabeledMetricType( @@ -41,7 +41,7 @@ class LabeledMetricTypeTest { lifetime = Lifetime.APPLICATION, name = "labeled_counter_metric", sendInPings = listOf("metrics"), - subMetric = counterMetric + subMetric = counterMetric, ) labeledCounterMetric["label1"].add(1) @@ -65,8 +65,8 @@ class LabeledMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "labeled_counter_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val labeledCounterMetric = LabeledMetricType( @@ -76,7 +76,7 @@ class LabeledMetricTypeTest { name = "labeled_counter_metric", sendInPings = listOf("metrics"), subMetric = counterMetric, - labels = setOf("foo", "bar", "baz") + labels = setOf("foo", "bar", "baz"), ) labeledCounterMetric["foo"].add(1) @@ -101,8 +101,8 @@ class LabeledMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "labeled_counter_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val labeledCounterMetric = LabeledMetricType( @@ -111,7 +111,7 @@ class LabeledMetricTypeTest { lifetime = Lifetime.APPLICATION, name = "labeled_counter_metric", sendInPings = listOf("metrics"), - subMetric = counterMetric + subMetric = counterMetric, ) for (i in 0..20) { @@ -135,8 +135,8 @@ class LabeledMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "labeled_counter_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val labeledCounterMetric = LabeledMetricType( @@ -145,7 +145,7 @@ class LabeledMetricTypeTest { lifetime = Lifetime.APPLICATION, name = "labeled_counter_metric", sendInPings = listOf("metrics"), - subMetric = counterMetric + subMetric = counterMetric, ) // Make sure Glean isn't initialized, and turn task queueing on @@ -175,8 +175,8 @@ class LabeledMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "labeled_counter_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val labeledCounterMetric = LabeledMetricType( @@ -185,7 +185,7 @@ class LabeledMetricTypeTest { lifetime = Lifetime.APPLICATION, name = "labeled_counter_metric", sendInPings = listOf("metrics"), - subMetric = counterMetric + subMetric = counterMetric, ) // These are actually fine now. @@ -197,12 +197,12 @@ class LabeledMetricTypeTest { assertEquals( 0, labeledCounterMetric.testGetNumRecordedErrors( - ErrorType.INVALID_LABEL - ) + ErrorType.INVALID_LABEL, + ), ) assertEquals( null, - labeledCounterMetric["__other__"].testGetValue() + labeledCounterMetric["__other__"].testGetValue(), ) // More than 71 characters? Not okay. @@ -212,12 +212,12 @@ class LabeledMetricTypeTest { assertEquals( 2, labeledCounterMetric.testGetNumRecordedErrors( - ErrorType.INVALID_LABEL - ) + ErrorType.INVALID_LABEL, + ), ) assertEquals( 2, - labeledCounterMetric["__other__"].testGetValue() + labeledCounterMetric["__other__"].testGetValue(), ) } @@ -229,8 +229,8 @@ class LabeledMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "labeled_boolean_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val labeledBooleanMetric = LabeledMetricType( @@ -239,7 +239,7 @@ class LabeledMetricTypeTest { lifetime = Lifetime.APPLICATION, name = "labeled_boolean_metric", sendInPings = listOf("metrics"), - subMetric = booleanMetric + subMetric = booleanMetric, ) // These are actually fine now. @@ -251,12 +251,12 @@ class LabeledMetricTypeTest { assertEquals( 0, labeledBooleanMetric.testGetNumRecordedErrors( - ErrorType.INVALID_LABEL - ) + ErrorType.INVALID_LABEL, + ), ) assertEquals( null, - labeledBooleanMetric["__other__"].testGetValue() + labeledBooleanMetric["__other__"].testGetValue(), ) // More than 71 characters? Not okay. @@ -266,12 +266,12 @@ class LabeledMetricTypeTest { assertEquals( 2, labeledBooleanMetric.testGetNumRecordedErrors( - ErrorType.INVALID_LABEL - ) + ErrorType.INVALID_LABEL, + ), ) assertEquals( true, - labeledBooleanMetric["__other__"].testGetValue() + labeledBooleanMetric["__other__"].testGetValue(), ) } @@ -283,8 +283,8 @@ class LabeledMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "labeled_string_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val labeledStringMetric = LabeledMetricType( @@ -293,7 +293,7 @@ class LabeledMetricTypeTest { lifetime = Lifetime.APPLICATION, name = "labeled_string_metric", sendInPings = listOf("metrics"), - subMetric = stringMetric + subMetric = stringMetric, ) // These are actually fine now. @@ -305,12 +305,12 @@ class LabeledMetricTypeTest { assertEquals( 0, labeledStringMetric.testGetNumRecordedErrors( - ErrorType.INVALID_LABEL - ) + ErrorType.INVALID_LABEL, + ), ) assertEquals( null, - labeledStringMetric["__other__"].testGetValue() + labeledStringMetric["__other__"].testGetValue(), ) // More than 71 characters? Not okay. @@ -320,12 +320,12 @@ class LabeledMetricTypeTest { assertEquals( 2, labeledStringMetric.testGetNumRecordedErrors( - ErrorType.INVALID_LABEL - ) + ErrorType.INVALID_LABEL, + ), ) assertEquals( "foo", - labeledStringMetric["__other__"].testGetValue() + labeledStringMetric["__other__"].testGetValue(), ) } @@ -337,8 +337,8 @@ class LabeledMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "labeled_string_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val labeledStringMetric = LabeledMetricType( @@ -347,7 +347,7 @@ class LabeledMetricTypeTest { lifetime = Lifetime.APPLICATION, name = "labeled_string_metric", sendInPings = listOf("metrics"), - subMetric = stringMetric + subMetric = stringMetric, ) labeledStringMetric["label1"].set("foo") @@ -365,8 +365,8 @@ class LabeledMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "labeled_string_list_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val labeledBooleanMetric = LabeledMetricType( @@ -375,7 +375,7 @@ class LabeledMetricTypeTest { lifetime = Lifetime.APPLICATION, name = "labeled_string_list_metric", sendInPings = listOf("metrics"), - subMetric = booleanMetric + subMetric = booleanMetric, ) labeledBooleanMetric["label1"].set(false) @@ -393,9 +393,9 @@ class LabeledMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "labeled_event_metric", - sendInPings = listOf("metrics") + sendInPings = listOf("metrics"), ), - allowedExtraKeys = emptyList() + allowedExtraKeys = emptyList(), ) val labeledEventMetric = LabeledMetricType>( @@ -404,7 +404,7 @@ class LabeledMetricTypeTest { lifetime = Lifetime.APPLICATION, name = "labeled_event_metric", sendInPings = listOf("metrics"), - subMetric = eventMetric + subMetric = eventMetric, ) labeledEventMetric["label1"] @@ -421,8 +421,8 @@ class LabeledMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "labeled_counter_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val labeledCounterMetric = LabeledMetricType( @@ -432,7 +432,7 @@ class LabeledMetricTypeTest { name = "labeled_counter_metric", sendInPings = listOf("metrics"), subMetric = counterMetric, - labels = setOf("foo", "bar", "baz") + labels = setOf("foo", "bar", "baz"), ) // Increment using a label name first. @@ -463,8 +463,8 @@ class LabeledMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "labeled_nocrash_counter", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val labeledCounterMetric = LabeledMetricType( @@ -474,7 +474,7 @@ class LabeledMetricTypeTest { name = "labeled_nocrash", sendInPings = listOf("metrics"), subMetric = counterMetric, - labels = setOf("foo") + labels = setOf("foo"), ) // We go higher than the maximum of `(1<<15)-1 = 32767`. diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/MemoryDistributionMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/MemoryDistributionMetricTypeTest.kt index 786c446ef3..097cf41563 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/MemoryDistributionMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/MemoryDistributionMetricTypeTest.kt @@ -31,7 +31,7 @@ class MemoryDistributionMetricTypeTest { name = "memory_distribution", sendInPings = listOf("store1"), ), - memoryUnit = MemoryUnit.KILOBYTE + memoryUnit = MemoryUnit.KILOBYTE, ) // Accumulate a few values @@ -64,7 +64,7 @@ class MemoryDistributionMetricTypeTest { name = "memory_distribution", sendInPings = listOf("store1"), ), - memoryUnit = MemoryUnit.GIGABYTE + memoryUnit = MemoryUnit.GIGABYTE, ) metric.accumulate(2048L) @@ -91,7 +91,7 @@ class MemoryDistributionMetricTypeTest { name = "memory_distribution", sendInPings = listOf("store1"), ), - memoryUnit = MemoryUnit.KILOBYTE + memoryUnit = MemoryUnit.KILOBYTE, ) metric.accumulate(1L) @@ -99,7 +99,7 @@ class MemoryDistributionMetricTypeTest { // Check that nothing was recorded. assertNull( "MemoryDistributions without a lifetime should not record data.", - metric.testGetValue() + metric.testGetValue(), ) } @@ -114,7 +114,7 @@ class MemoryDistributionMetricTypeTest { name = "memory_distribution", sendInPings = listOf("store1"), ), - memoryUnit = MemoryUnit.KILOBYTE + memoryUnit = MemoryUnit.KILOBYTE, ) assertNull(metric.testGetValue()) } @@ -130,7 +130,7 @@ class MemoryDistributionMetricTypeTest { name = "memory_distribution", sendInPings = listOf("store1", "store2", "store3"), ), - memoryUnit = MemoryUnit.KILOBYTE + memoryUnit = MemoryUnit.KILOBYTE, ) // Accumulate a few values @@ -172,7 +172,7 @@ class MemoryDistributionMetricTypeTest { name = "memory_distribution_samples", sendInPings = listOf("store1"), ), - memoryUnit = MemoryUnit.KILOBYTE + memoryUnit = MemoryUnit.KILOBYTE, ) // Accumulate a few values diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/PingTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/PingTypeTest.kt index ace374ddbc..71e0eba89a 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/PingTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/PingTypeTest.kt @@ -45,15 +45,15 @@ class PingTypeTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port - ) + serverEndpoint = "http://" + server.hostName + ":" + server.port, + ), ) val customPing = PingType( name = "custom", includeClientId = true, sendIfEmpty = false, - reasonCodes = listOf() + reasonCodes = listOf(), ) val counter = CounterMetricType( @@ -62,8 +62,8 @@ class PingTypeTest { category = "test", lifetime = Lifetime.PING, name = "counter", - sendInPings = listOf("custom") - ) + sendInPings = listOf("custom"), + ), ) counter.add() @@ -110,15 +110,15 @@ class PingTypeTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port - ) + serverEndpoint = "http://" + server.hostName + ":" + server.port, + ), ) val customPing = PingType( name = "custom_ping", includeClientId = true, sendIfEmpty = false, - reasonCodes = listOf() + reasonCodes = listOf(), ) val counter = CounterMetricType( @@ -127,8 +127,8 @@ class PingTypeTest { category = "test", lifetime = Lifetime.PING, name = "counter", - sendInPings = listOf("custom_ping") - ) + sendInPings = listOf("custom_ping"), + ), ) counter.add() @@ -156,15 +156,15 @@ class PingTypeTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port - ) + serverEndpoint = "http://" + server.hostName + ":" + server.port, + ), ) val customPing = PingType( name = "custom-ping", includeClientId = true, sendIfEmpty = false, - reasonCodes = listOf() + reasonCodes = listOf(), ) val counter = CounterMetricType( @@ -173,8 +173,8 @@ class PingTypeTest { category = "test", lifetime = Lifetime.PING, name = "counter", - sendInPings = listOf("custom-ping") - ) + sendInPings = listOf("custom-ping"), + ), ) counter.add() @@ -202,15 +202,15 @@ class PingTypeTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port - ) + serverEndpoint = "http://" + server.hostName + ":" + server.port, + ), ) val customPing = PingType( name = "custom", includeClientId = false, sendIfEmpty = false, - reasonCodes = listOf() + reasonCodes = listOf(), ) val counter = CounterMetricType( @@ -219,8 +219,8 @@ class PingTypeTest { category = "test", lifetime = Lifetime.PING, name = "counter", - sendInPings = listOf("custom") - ) + sendInPings = listOf("custom"), + ), ) counter.add() @@ -249,8 +249,8 @@ class PingTypeTest { category = "test", lifetime = Lifetime.PING, name = "counter", - sendInPings = listOf("unknown") - ) + sendInPings = listOf("unknown"), + ), ) val context = getContext() @@ -258,8 +258,8 @@ class PingTypeTest { resetGlean( context, Glean.configuration.copy( - serverEndpoint = "http://" + server.hostName + ":" + server.port - ) + serverEndpoint = "http://" + server.hostName + ":" + server.port, + ), ) counter.add() @@ -269,7 +269,7 @@ class PingTypeTest { assertFalse( "We shouldn't have any pings scheduled", - getWorkerStatus(context, PingUploadWorker.PING_WORKER_TAG).isEnqueued + getWorkerStatus(context, PingUploadWorker.PING_WORKER_TAG).isEnqueued, ) } } diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/QuantityMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/QuantityMetricTypeTest.kt index c422cd6765..43c250f667 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/QuantityMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/QuantityMetricTypeTest.kt @@ -35,8 +35,8 @@ class QuantityMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "quantity_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) assertNull(quantityMetric.testGetValue()) @@ -64,8 +64,8 @@ class QuantityMetricTypeTest { category = "telemetry", lifetime = Lifetime.PING, name = "quantity_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Attempt to increment the quantity @@ -73,7 +73,7 @@ class QuantityMetricTypeTest { // Check that nothing was recorded. assertNull( "Quantities must not be recorded if they are disabled", - quantityMetric.testGetValue() + quantityMetric.testGetValue(), ) } @@ -87,8 +87,8 @@ class QuantityMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "quantity_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Attempt to store the quantity. @@ -96,7 +96,7 @@ class QuantityMetricTypeTest { // Check that nothing was recorded. assertNull( "Quantities must not be recorded if they are disabled", - quantityMetric.testGetValue() + quantityMetric.testGetValue(), ) } @@ -108,8 +108,8 @@ class QuantityMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "quantity_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) assertNull(quantityMetric.testGetValue()) } @@ -123,8 +123,8 @@ class QuantityMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "quantity_metric", - sendInPings = listOf("store1", "store2") - ) + sendInPings = listOf("store1", "store2"), + ), ) quantityMetric.set(1L) @@ -144,8 +144,8 @@ class QuantityMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "quantity_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) quantityMetric.set(-10L) diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/RateMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/RateMetricTypeTest.kt index a71cbb90c9..7994915bf6 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/RateMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/RateMetricTypeTest.kt @@ -33,8 +33,8 @@ class RateMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "rate_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) assertNull(rateMetric.testGetValue()) @@ -57,15 +57,15 @@ class RateMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "rate_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) rateMetric.addToNumerator(1) rateMetric.addToDenominator(1) assertNull( "rates must not be recorded if they are disabled", - rateMetric.testGetValue() + rateMetric.testGetValue(), ) } @@ -76,7 +76,7 @@ class RateMetricTypeTest { name = "rate1", sendInPings = listOf("store1"), lifetime = Lifetime.APPLICATION, - disabled = false + disabled = false, ) val meta2 = CommonMetricData( @@ -84,7 +84,7 @@ class RateMetricTypeTest { name = "rate2", sendInPings = listOf("store1"), lifetime = Lifetime.APPLICATION, - disabled = false + disabled = false, ) val denom = DenominatorMetricType( @@ -93,9 +93,9 @@ class RateMetricTypeTest { name = "counter", sendInPings = listOf("store1"), lifetime = Lifetime.APPLICATION, - disabled = false + disabled = false, ), - listOf(meta1, meta2) + listOf(meta1, meta2), ) val num1 = NumeratorMetricType(meta1) diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/StringListMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/StringListMetricTypeTest.kt index 9aa9fe4d59..9e74c5d8a2 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/StringListMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/StringListMetricTypeTest.kt @@ -35,8 +35,8 @@ class StringListMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "string_list_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Record two lists using add and set @@ -70,8 +70,8 @@ class StringListMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "string_list_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Record two lists using set and add @@ -105,8 +105,8 @@ class StringListMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "string_list_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Attempt to store the string list using set. @@ -114,7 +114,7 @@ class StringListMetricTypeTest { // Check that nothing was recorded. assertNull( "StringLists must not be recorded if they are disabled", - stringListMetric.testGetValue() + stringListMetric.testGetValue(), ) // Attempt to store the string list using add. @@ -122,7 +122,7 @@ class StringListMetricTypeTest { // Check that nothing was recorded. assertNull( "StringLists must not be recorded if they are disabled", - stringListMetric.testGetValue() + stringListMetric.testGetValue(), ) } @@ -134,8 +134,8 @@ class StringListMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "string_list_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) assertNull(stringListMetric.testGetValue()) } @@ -149,8 +149,8 @@ class StringListMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "string_list_metric", - sendInPings = listOf("store1", "store2") - ) + sendInPings = listOf("store1", "store2"), + ), ) // Record two lists using add and set @@ -184,8 +184,8 @@ class StringListMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "string_list_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) for (x in 0..100) { diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/StringMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/StringMetricTypeTest.kt index 1739ce977a..05113e0d4f 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/StringMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/StringMetricTypeTest.kt @@ -35,8 +35,8 @@ class StringMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "string_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Record two strings of the same type, with a little delay. @@ -60,8 +60,8 @@ class StringMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "stringMetric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Attempt to store the string. @@ -69,7 +69,7 @@ class StringMetricTypeTest { // Check that nothing was recorded. assertNull( "Strings must not be recorded if they are disabled", - stringMetric.testGetValue() + stringMetric.testGetValue(), ) } @@ -81,8 +81,8 @@ class StringMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "stringMetric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) assertNull(stringMetric.testGetValue()) } @@ -96,8 +96,8 @@ class StringMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "string_metric", - sendInPings = listOf("store1", "store2") - ) + sendInPings = listOf("store1", "store2"), + ), ) // Record two strings of the same type, with a little delay. @@ -120,8 +120,8 @@ class StringMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "string_metric", - sendInPings = listOf("store1", "store2") - ) + sendInPings = listOf("store1", "store2"), + ), ) stringMetric.set("0123456789".repeat(11)) diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/TimespanMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/TimespanMetricTypeTest.kt index b856700cef..aae63d2271 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/TimespanMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/TimespanMetricTypeTest.kt @@ -37,7 +37,7 @@ class TimespanMetricTypeTest { name = "timespan_metric", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.MILLISECOND + timeUnit = TimeUnit.MILLISECOND, ) // Record a timespan. @@ -59,7 +59,7 @@ class TimespanMetricTypeTest { name = "timespan_metric", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.MILLISECOND + timeUnit = TimeUnit.MILLISECOND, ) // Record a timespan. @@ -72,7 +72,7 @@ class TimespanMetricTypeTest { // Check that data was not recorded. assertNull( "The API should not record a counter if metric is disabled", - metric.testGetValue() + metric.testGetValue(), ) } @@ -87,7 +87,7 @@ class TimespanMetricTypeTest { name = "timespan_metric", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.MILLISECOND + timeUnit = TimeUnit.MILLISECOND, ) // Record a timespan. @@ -98,7 +98,7 @@ class TimespanMetricTypeTest { // Check that data was not recorded. assertNull( "The API should not record a counter if metric is cancelled", - metric.testGetValue() + metric.testGetValue(), ) assertEquals(1, metric.testGetNumRecordedErrors(ErrorType.INVALID_STATE)) } @@ -113,7 +113,7 @@ class TimespanMetricTypeTest { name = "timespan_metric", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.MILLISECOND + timeUnit = TimeUnit.MILLISECOND, ) assertNull(metric.testGetValue()) } @@ -129,7 +129,7 @@ class TimespanMetricTypeTest { name = "timespan_metric", sendInPings = listOf("store1", "store2"), ), - timeUnit = TimeUnit.MILLISECOND + timeUnit = TimeUnit.MILLISECOND, ) // Record a timespan. @@ -151,7 +151,7 @@ class TimespanMetricTypeTest { name = "timespan_metric", sendInPings = listOf("store1", "store2"), ), - timeUnit = TimeUnit.MILLISECOND + timeUnit = TimeUnit.MILLISECOND, ) // Record a timespan. @@ -175,7 +175,7 @@ class TimespanMetricTypeTest { name = "timespan_metric", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.NANOSECOND + timeUnit = TimeUnit.NANOSECOND, ) // Record a timespan. @@ -201,7 +201,7 @@ class TimespanMetricTypeTest { name = "explicit_timespan", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.SECOND + timeUnit = TimeUnit.SECOND, ) metric.setRawNanos(timespanNanos) @@ -220,7 +220,7 @@ class TimespanMetricTypeTest { name = "explicit_timespan_1", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.SECOND + timeUnit = TimeUnit.SECOND, ) metric.setRawNanos(timespanNanos) @@ -243,7 +243,7 @@ class TimespanMetricTypeTest { name = "explicit_timespan_2", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.SECOND + timeUnit = TimeUnit.SECOND, ) metric.start() @@ -267,7 +267,7 @@ class TimespanMetricTypeTest { name = "explicit_timespan_3", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.SECOND + timeUnit = TimeUnit.SECOND, ) metric.start() @@ -290,7 +290,7 @@ class TimespanMetricTypeTest { name = "timespan_metric", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.MILLISECOND + timeUnit = TimeUnit.MILLISECOND, ) // Create a function to measure, which also returns a value to test that we properly pass @@ -322,7 +322,7 @@ class TimespanMetricTypeTest { name = "inlined", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.NANOSECOND + timeUnit = TimeUnit.NANOSECOND, ) // We define a function that measures the whole function call runtime @@ -354,7 +354,7 @@ class TimespanMetricTypeTest { name = "timespan_metric", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.MILLISECOND + timeUnit = TimeUnit.MILLISECOND, ) // Create a function that will throw a NPE diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/TimingDistributionMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/TimingDistributionMetricTypeTest.kt index c1875bbcba..e6fde27248 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/TimingDistributionMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/TimingDistributionMetricTypeTest.kt @@ -38,9 +38,9 @@ class TimingDistributionMetricTypeTest { category = "telemetry", lifetime = Lifetime.PING, name = "timing_distribution", - sendInPings = listOf("store1") + sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.NANOSECOND + timeUnit = TimeUnit.NANOSECOND, ) // Accumulate a few values @@ -74,7 +74,7 @@ class TimingDistributionMetricTypeTest { name = "timing_distribution", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.NANOSECOND + timeUnit = TimeUnit.NANOSECOND, ) val id = metric.start() @@ -83,7 +83,7 @@ class TimingDistributionMetricTypeTest { // Check that nothing was recorded. assertNull( "Disabled TimingDistributions should not record data.", - metric.testGetValue() + metric.testGetValue(), ) } @@ -98,7 +98,7 @@ class TimingDistributionMetricTypeTest { name = "timing_distribution", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.NANOSECOND + timeUnit = TimeUnit.NANOSECOND, ) assertNull(metric.testGetValue()) } @@ -114,7 +114,7 @@ class TimingDistributionMetricTypeTest { name = "timing_distribution", sendInPings = listOf("store1", "store2", "store3"), ), - timeUnit = TimeUnit.NANOSECOND + timeUnit = TimeUnit.NANOSECOND, ) // Accumulate a few values @@ -159,7 +159,7 @@ class TimingDistributionMetricTypeTest { name = "timing_distribution_samples", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.SECOND + timeUnit = TimeUnit.SECOND, ) // Accumulate a few values @@ -196,7 +196,7 @@ class TimingDistributionMetricTypeTest { name = "timing_distribution_samples", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.SECOND + timeUnit = TimeUnit.SECOND, ) val timerId = metric.start() @@ -218,7 +218,7 @@ class TimingDistributionMetricTypeTest { name = "timing_distribution_samples", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.SECOND + timeUnit = TimeUnit.SECOND, ) val timerId = metric.start() @@ -238,7 +238,7 @@ class TimingDistributionMetricTypeTest { name = "timing_distribution_samples", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.SECOND + timeUnit = TimeUnit.SECOND, ) metric.stopAndAccumulate(GleanTimerId(1337UL)) @@ -255,7 +255,7 @@ class TimingDistributionMetricTypeTest { name = "timing_distribution_samples", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.NANOSECOND + timeUnit = TimeUnit.NANOSECOND, ) // Create a test function to "measure". This works by mocking the getElapsedNanos return @@ -298,7 +298,7 @@ class TimingDistributionMetricTypeTest { name = "inlined", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.NANOSECOND + timeUnit = TimeUnit.NANOSECOND, ) // We define a function that measures the whole function call runtime @@ -332,7 +332,7 @@ class TimingDistributionMetricTypeTest { name = "timing_distribution_samples", sendInPings = listOf("store1"), ), - timeUnit = TimeUnit.SECOND + timeUnit = TimeUnit.SECOND, ) // Create a test function that throws a NPE diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/UrlMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/UrlMetricTypeTest.kt index 3a856ff8df..cab0598556 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/UrlMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/UrlMetricTypeTest.kt @@ -29,8 +29,8 @@ class UrlMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "url_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Record two URLs of the same type, with a little delay. @@ -54,8 +54,8 @@ class UrlMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "urlMetric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Attempt to store the URL. @@ -63,7 +63,7 @@ class UrlMetricTypeTest { // Check that nothing was recorded. assertNull( "Url must not be recorded if they are disabled", - urlMetric.testGetValue() + urlMetric.testGetValue(), ) } @@ -75,8 +75,8 @@ class UrlMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "urlMetric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) assertNull(urlMetric.testGetValue()) } @@ -90,8 +90,8 @@ class UrlMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "url_metric", - sendInPings = listOf("store1", "store2") - ) + sendInPings = listOf("store1", "store2"), + ), ) urlMetric.set("glean://value") @@ -113,8 +113,8 @@ class UrlMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "url_metric", - sendInPings = listOf("store1", "store2") - ) + sendInPings = listOf("store1", "store2"), + ), ) // Whenever the URL is longer than our MAX_URL_LENGTH, we truncate the URL to the diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/UuidMetricTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/UuidMetricTypeTest.kt index 51ec8e0561..26b6c515fb 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/UuidMetricTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/UuidMetricTypeTest.kt @@ -35,8 +35,8 @@ class UuidMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "uuid_metric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Check that there is no UUID recorded @@ -65,8 +65,8 @@ class UuidMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "uuidMetric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) // Attempt to store the uuid. @@ -74,7 +74,7 @@ class UuidMetricTypeTest { // Check that nothing was recorded. assertNull( "Uuids must not be recorded if they are disabled", - uuidMetric.testGetValue() + uuidMetric.testGetValue(), ) } @@ -86,8 +86,8 @@ class UuidMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "uuidMetric", - sendInPings = listOf("store1") - ) + sendInPings = listOf("store1"), + ), ) assertNull(uuidMetric.testGetValue()) } @@ -101,8 +101,8 @@ class UuidMetricTypeTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "uuid_metric", - sendInPings = listOf("store1", "store2") - ) + sendInPings = listOf("store1", "store2"), + ), ) // Record two uuids of the same type, with a little delay. diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/scheduler/MetricsPingSchedulerTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/scheduler/MetricsPingSchedulerTest.kt index 5481716dde..b85ca68154 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/scheduler/MetricsPingSchedulerTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/scheduler/MetricsPingSchedulerTest.kt @@ -85,8 +85,10 @@ class MetricsPingSchedulerTest { assertEquals( 60 * 60 * 1000L, metricsPingScheduler.getMillisecondsUntilDueTime( - sendTheNextCalendarDay = false, now = fakeNow, dueHourOfTheDay = 4 - ) + sendTheNextCalendarDay = false, + now = fakeNow, + dueHourOfTheDay = 4, + ), ) // If we're exactly at 4am, there must be no delay. @@ -94,8 +96,10 @@ class MetricsPingSchedulerTest { assertEquals( 0, metricsPingScheduler.getMillisecondsUntilDueTime( - sendTheNextCalendarDay = false, now = fakeNow, dueHourOfTheDay = 4 - ) + sendTheNextCalendarDay = false, + now = fakeNow, + dueHourOfTheDay = 4, + ), ) // Set the clock to after 4 of some minutes. @@ -105,8 +109,10 @@ class MetricsPingSchedulerTest { assertEquals( 0, metricsPingScheduler.getMillisecondsUntilDueTime( - sendTheNextCalendarDay = false, now = fakeNow, dueHourOfTheDay = 4 - ) + sendTheNextCalendarDay = false, + now = fakeNow, + dueHourOfTheDay = 4, + ), ) // With `sendTheNextCalendarDay` true, we expect the function to return 23 hours @@ -114,8 +120,10 @@ class MetricsPingSchedulerTest { assertEquals( 23 * 60 * 60 * 1000L + 55 * 60 * 1000L, metricsPingScheduler.getMillisecondsUntilDueTime( - sendTheNextCalendarDay = true, now = fakeNow, dueHourOfTheDay = 4 - ) + sendTheNextCalendarDay = true, + now = fakeNow, + dueHourOfTheDay = 4, + ), ) } @@ -177,7 +185,7 @@ class MetricsPingSchedulerTest { assertNull( "null must be reported when no date is stored", - mps.getLastCollectedDate() + mps.getLastCollectedDate(), ) } @@ -192,7 +200,7 @@ class MetricsPingSchedulerTest { // Wrong key type should trigger returning null. assertNull( "null must be reported when no date is stored", - mps.getLastCollectedDate() + mps.getLastCollectedDate(), ) // Wrong date format string should trigger returning null. @@ -203,7 +211,7 @@ class MetricsPingSchedulerTest { assertNull( "null must be reported when the date key is of unexpected format", - mps.getLastCollectedDate() + mps.getLastCollectedDate(), ) } @@ -213,13 +221,13 @@ class MetricsPingSchedulerTest { val mps = MetricsPingScheduler( context, GleanBuildInfo.buildInfo, - testDate + testDate, ) // Wrong key type should trigger returning null. assertEquals( parseISOTimeString(testDate), - mps.getLastCollectedDate() + mps.getLastCollectedDate(), ) } @@ -233,14 +241,14 @@ class MetricsPingSchedulerTest { assertEquals( "The date the ping was collected must be reported", expectedDate, - mps.getLastCollectedDate() + mps.getLastCollectedDate(), ) } @Test fun `collectMetricsPing must update the last sent date and reschedule the collection`() { val mpsSpy = spy( - MetricsPingScheduler(context, GleanBuildInfo.buildInfo) + MetricsPingScheduler(context, GleanBuildInfo.buildInfo), ) // Ensure we have the right assumptions in place: the methods were not called @@ -249,7 +257,7 @@ class MetricsPingSchedulerTest { verify(mpsSpy, times(0)).schedulePingCollection( any(), anyBoolean(), - eq(Pings.metricsReasonCodes.overdue) + eq(Pings.metricsReasonCodes.overdue), ) mpsSpy.collectPingAndReschedule(Calendar.getInstance(), false, Pings.metricsReasonCodes.overdue) @@ -259,7 +267,7 @@ class MetricsPingSchedulerTest { verify(mpsSpy, times(1)).schedulePingCollection( any(), anyBoolean(), - eq(Pings.metricsReasonCodes.reschedule) + eq(Pings.metricsReasonCodes.reschedule), ) } @@ -271,8 +279,8 @@ class MetricsPingSchedulerTest { resetGlean( context, Configuration( - serverEndpoint = "http://" + server.hostName + ":" + server.port - ) + serverEndpoint = "http://" + server.hostName + ":" + server.port, + ), ) try { @@ -283,8 +291,8 @@ class MetricsPingSchedulerTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "string_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val expectedValue = "test-only metric" @@ -295,7 +303,7 @@ class MetricsPingSchedulerTest { Glean.metricsPingScheduler!!.collectPingAndReschedule( Calendar.getInstance(), false, - Pings.metricsReasonCodes.overdue + Pings.metricsReasonCodes.overdue, ) // Trigger worker task to upload the pings in the background @@ -316,12 +324,12 @@ class MetricsPingSchedulerTest { expectedValue, metricsJson.getJSONObject("metrics") .getJSONObject("string") - .getString("telemetry.string_metric") + .getString("telemetry.string_metric"), ) assertEquals( "The reason should be 'overdue'", "overdue", - metricsJson.getJSONObject("ping_info").getString("reason") + metricsJson.getJSONObject("ping_info").getString("reason"), ) } finally { server.shutdown() @@ -345,7 +353,7 @@ class MetricsPingSchedulerTest { verify(mpsSpy, never()).collectPingAndReschedule( any(), eq(true), - eq(Pings.metricsReasonCodes.overdue) + eq(Pings.metricsReasonCodes.overdue), ) // Make sure to return the fake date when requested. @@ -361,7 +369,7 @@ class MetricsPingSchedulerTest { verify(mpsSpy, times(1)).collectPingAndReschedule( fakeNow, true, - Pings.metricsReasonCodes.overdue + Pings.metricsReasonCodes.overdue, ) } @@ -391,12 +399,12 @@ class MetricsPingSchedulerTest { verify(mpsSpy, times(1)).schedulePingCollection( fakeNow, sendTheNextCalendarDay = true, - reason = Pings.metricsReasonCodes.tomorrow + reason = Pings.metricsReasonCodes.tomorrow, ) verify(mpsSpy, never()).schedulePingCollection( eq(fakeNow), sendTheNextCalendarDay = eq(false), - reason = any() + reason = any(), ) verify(mpsSpy, never()).collectPingAndReschedule(any(), eq(true), any()) } @@ -430,12 +438,12 @@ class MetricsPingSchedulerTest { verify(mpsSpy, times(1)).schedulePingCollection( fakeNow, sendTheNextCalendarDay = false, - reason = Pings.metricsReasonCodes.today + reason = Pings.metricsReasonCodes.today, ) verify(mpsSpy, never()).schedulePingCollection( eq(fakeNow), sendTheNextCalendarDay = eq(true), - reason = any() + reason = any(), ) verify(mpsSpy, never()).collectPingAndReschedule(any(), eq(true), reason = any()) } @@ -467,7 +475,7 @@ class MetricsPingSchedulerTest { verify(mpsSpy, times(1)).schedulePingCollection( fakeNow, sendTheNextCalendarDay = false, - reason = Pings.metricsReasonCodes.today + reason = Pings.metricsReasonCodes.today, ) } @@ -494,7 +502,7 @@ class MetricsPingSchedulerTest { // Start the web-server that will receive the metrics ping. val server = getMockWebServer() val configuration = Configuration( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ) val oldVersion = "version.0" @@ -513,7 +521,7 @@ class MetricsPingSchedulerTest { context, true, configuration, - oldBuildInfo + oldBuildInfo, ) // Create a metric and set its value. We expect this to be sent after the restart @@ -523,8 +531,8 @@ class MetricsPingSchedulerTest { category = "telemetry", lifetime = Lifetime.PING, name = "expected_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val expectedValue = "canary" expectedStringMetric.set(expectedValue) @@ -542,7 +550,7 @@ class MetricsPingSchedulerTest { context, true, configuration, - newBuildInfo + newBuildInfo, ) // Unfortunately, we need to delay a bit here to give init time to run because we are @@ -562,29 +570,33 @@ class MetricsPingSchedulerTest { assertEquals( "The metrics ping reason must be 'upgrade'", - "upgrade", pingJson.getJSONObject("ping_info")["reason"] + "upgrade", + pingJson.getJSONObject("ping_info")["reason"], ) assertEquals( "The received ping must contain the old version", - oldVersion, pingJson.getJSONObject("client_info")["app_display_version"] + oldVersion, + pingJson.getJSONObject("client_info")["app_display_version"], ) val stringMetrics = pingJson.getJSONObject("metrics")["string"] as JSONObject assertEquals( "The received ping must contain the expected metric", - expectedValue, stringMetrics.getString("telemetry.expected_metric") + expectedValue, + stringMetrics.getString("telemetry.expected_metric"), ) val experiments = pingJson.getJSONObject("ping_info")["experiments"] as JSONObject val testExperiment = experiments["test-experiment"] as JSONObject assertNotNull( "The received ping must contain the experiment", - testExperiment + testExperiment, ) assertEquals( "Experiment branch should exist and match", - "a", testExperiment.getString("branch") + "a", + testExperiment.getString("branch"), ) } finally { server.shutdown() @@ -621,7 +633,7 @@ class MetricsPingSchedulerTest { assertEquals( "The scheduler must save the date the ping was collected", fakeNow.time, - mpsSpy.getLastCollectedDate() + mpsSpy.getLastCollectedDate(), ) // Verify that we're immediately collecting. @@ -642,7 +654,7 @@ class MetricsPingSchedulerTest { Glean.metricsPingScheduler!!.schedulePingCollection( Calendar.getInstance(), sendTheNextCalendarDay = false, - reason = Pings.metricsReasonCodes.overdue + reason = Pings.metricsReasonCodes.overdue, ) // We expect the worker to be scheduled. @@ -663,7 +675,7 @@ class MetricsPingSchedulerTest { // Verify that the worker is enqueued assertNotNull( "MetricsPingWorker is enqueued", - Glean.metricsPingScheduler!!.timer + Glean.metricsPingScheduler!!.timer, ) // Cancel the worker @@ -672,7 +684,7 @@ class MetricsPingSchedulerTest { // Verify worker has been cancelled assertNull( "MetricsPingWorker is not enqueued", - Glean.metricsPingScheduler!!.timer + Glean.metricsPingScheduler!!.timer, ) } @@ -702,8 +714,8 @@ class MetricsPingSchedulerTest { category = "telemetry", lifetime = Lifetime.PING, name = "expected_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val expectedValue = "must-exist-in-the-first-ping" @@ -722,8 +734,8 @@ class MetricsPingSchedulerTest { category = "telemetry", lifetime = Lifetime.PING, name = "canary_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val canaryValue = "must-not-be-in-the-first-ping" stringMetric.set(canaryValue) @@ -747,8 +759,8 @@ class MetricsPingSchedulerTest { clearStores = false, uploadEnabled = true, config = Configuration( - serverEndpoint = "http://" + server.hostName + ":" + server.port - ) + serverEndpoint = "http://" + server.hostName + ":" + server.port, + ), ) // Trigger worker task to upload the pings in the background. @@ -763,11 +775,11 @@ class MetricsPingSchedulerTest { assertFalse( "The canary metric must not be present in this ping", - metricsJsonData.contains("must-not-be-in-the-first-ping") + metricsJsonData.contains("must-not-be-in-the-first-ping"), ) assertTrue( "The expected metric must be in this ping", - metricsJsonData.contains(expectedValue) + metricsJsonData.contains(expectedValue), ) } finally { server.shutdown() @@ -800,8 +812,8 @@ class MetricsPingSchedulerTest { category = "telemetry", lifetime = Lifetime.APPLICATION, name = "test_applifetime_metric", - sendInPings = listOf("metrics") - ) + sendInPings = listOf("metrics"), + ), ) val expectedString = "I-will-survive!" @@ -825,9 +837,9 @@ class MetricsPingSchedulerTest { resetGlean( context, Configuration( - serverEndpoint = "http://" + server.hostName + ":" + server.port + serverEndpoint = "http://" + server.hostName + ":" + server.port, ), - clearStores = false + clearStores = false, ) // Trigger worker task to upload the pings in the background. @@ -846,16 +858,16 @@ class MetricsPingSchedulerTest { expectedString, metricsJson.getJSONObject("metrics") .getJSONObject("string") - .getString("telemetry.test_applifetime_metric") + .getString("telemetry.test_applifetime_metric"), ) assertEquals( "The reason should be 'overdue'", "overdue", - metricsJson.getJSONObject("ping_info").getString("reason") + metricsJson.getJSONObject("ping_info").getString("reason"), ) assertNull( "The metric must be cleared after startup", - testMetric.testGetValue() + testMetric.testGetValue(), ) } finally { server.shutdown() diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/scheduler/PingUploadWorkerTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/scheduler/PingUploadWorkerTest.kt index e8b6c42531..2dcc97bfeb 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/scheduler/PingUploadWorkerTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/scheduler/PingUploadWorkerTest.kt @@ -61,7 +61,7 @@ class PingUploadWorkerTest { // Verify that the worker is enqueued Assert.assertTrue( "PingUploadWorker is enqueued", - getWorkerStatus(context, PingUploadWorker.PING_WORKER_TAG).isEnqueued + getWorkerStatus(context, PingUploadWorker.PING_WORKER_TAG).isEnqueued, ) // Cancel the worker @@ -70,7 +70,7 @@ class PingUploadWorkerTest { // Verify worker has been cancelled Assert.assertFalse( "PingUploadWorker is not enqueued", - getWorkerStatus(context, PingUploadWorker.PING_WORKER_TAG).isEnqueued + getWorkerStatus(context, PingUploadWorker.PING_WORKER_TAG).isEnqueued, ) } } diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/utils/DateUtilsTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/utils/DateUtilsTest.kt index 66376bf952..1ff9080359 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/utils/DateUtilsTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/utils/DateUtilsTest.kt @@ -16,15 +16,15 @@ class DateUtilsTest { @Test fun `test roundtripping ISO date formats`() { for ( - timeUnit in listOf( - TimeUnit.NANOSECOND, - TimeUnit.MICROSECOND, - TimeUnit.MILLISECOND, - TimeUnit.SECOND, - TimeUnit.MINUTE, - TimeUnit.HOUR, - TimeUnit.DAY - ) + timeUnit in listOf( + TimeUnit.NANOSECOND, + TimeUnit.MICROSECOND, + TimeUnit.MILLISECOND, + TimeUnit.SECOND, + TimeUnit.MINUTE, + TimeUnit.HOUR, + TimeUnit.DAY, + ) ) { val dateString = getISOTimeString(truncateTo = timeUnit) val parsedDate = parseISOTimeString(dateString)!! diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/utils/KArgumentCaptor.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/utils/KArgumentCaptor.kt index dac6882d87..6fe9d1c4da 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/utils/KArgumentCaptor.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/utils/KArgumentCaptor.kt @@ -13,10 +13,11 @@ import kotlin.reflect.KClass inline fun argumentCaptor(): KArgumentCaptor { return KArgumentCaptor(ArgumentCaptor.forClass(T::class.java), T::class) } + @Suppress("UnusedPrivateMember") class KArgumentCaptor( private val captor: ArgumentCaptor, - private val tClass: KClass<*> + private val tClass: KClass<*>, ) { /** diff --git a/samples/android/app/src/androidTest/java/org/mozilla/samples/gleancore/pings/SharedTestUtils.kt b/samples/android/app/src/androidTest/java/org/mozilla/samples/gleancore/pings/SharedTestUtils.kt index 539171bf90..15e53c078c 100644 --- a/samples/android/app/src/androidTest/java/org/mozilla/samples/gleancore/pings/SharedTestUtils.kt +++ b/samples/android/app/src/androidTest/java/org/mozilla/samples/gleancore/pings/SharedTestUtils.kt @@ -68,7 +68,7 @@ fun waitForPingContent( pingName: String, pingReason: String?, server: MockWebServer, - maxAttempts: Int = 3 + maxAttempts: Int = 3, ): JSONObject? { var parsedPayload: JSONObject? = null @Suppress("LoopWithTooManyJumpStatements") diff --git a/samples/android/app/src/main/java/org/mozilla/samples/gleancore/GleanApplication.kt b/samples/android/app/src/main/java/org/mozilla/samples/gleancore/GleanApplication.kt index 3e29a4e0f7..828cfe59bc 100644 --- a/samples/android/app/src/main/java/org/mozilla/samples/gleancore/GleanApplication.kt +++ b/samples/android/app/src/main/java/org/mozilla/samples/gleancore/GleanApplication.kt @@ -34,7 +34,7 @@ class GleanApplication : Application() { Glean.initialize( applicationContext = applicationContext, uploadEnabled = true, - buildInfo = GleanBuildInfo.buildInfo + buildInfo = GleanBuildInfo.buildInfo, ) Test.timespan.start() From 212a737a518a4f828892bf71dcd501bc6ce7b577 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Mon, 19 Jun 2023 14:27:51 +0200 Subject: [PATCH 60/74] Add formatting commit to blame ignore file --- .git-blame-ignore-revs | 1 + 1 file changed, 1 insertion(+) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000000..62a07b51db --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1 @@ +00e22288040c8a14b4dcbf94a8eee9210757c476 # ktlint update & formatting From 243910595d3b856b0abc6554d9208bb81ae73173 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Thu, 15 Jun 2023 13:42:27 +0200 Subject: [PATCH 61/74] Shutdown timeout: Gracefully handle the waiting thread going away --- CHANGELOG.md | 2 ++ glean-core/rlb/examples/prototype.rs | 6 ++++++ glean-core/src/dispatcher/mod.rs | 6 ++++-- glean-core/src/lib.rs | 18 ++++++++++-------- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df4e91bc70..4e5cdf8e83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ [Full changelog](https://github.com/mozilla/glean/compare/v53.0.0...main) +* General + * Gracefully handle the waiting thread going away during shutdown ([#2503](https://github.com/mozilla/glean/pull/2503)) * Android * Update minimum supported Java byte code generation to 17 ([#2498](https://github.com/mozilla/glean/pull/2498/)) diff --git a/glean-core/rlb/examples/prototype.rs b/glean-core/rlb/examples/prototype.rs index 630638cc59..0e3ecc3909 100644 --- a/glean-core/rlb/examples/prototype.rs +++ b/glean-core/rlb/examples/prototype.rs @@ -57,8 +57,14 @@ fn main() { glean::initialize(cfg, client_info); glean_metrics::sample_boolean.set(true); + _ = glean_metrics::sample_boolean.test_get_value(None); PrototypePing.submit(None); + glean_core::dispatcher::launch(|| { + std::thread::sleep(std::time::Duration::from_secs(15)); + }); + glean::shutdown(); + std::thread::sleep(std::time::Duration::from_secs(10)); } diff --git a/glean-core/src/dispatcher/mod.rs b/glean-core/src/dispatcher/mod.rs index 257695c34e..48efa4ef96 100644 --- a/glean-core/src/dispatcher/mod.rs +++ b/glean-core/src/dispatcher/mod.rs @@ -172,8 +172,10 @@ impl DispatchGuard { // Blocking on the queue can only work if it is eventually flushed anyway. let task = Command::Task(Box::new(move || { - tx.send(()) - .expect("(worker) Can't send message on single-use channel"); + // In case the calling thread times out waiting for this + // the channel will be dropped. + // But in case the work continues we don't want to panic. + _ = tx.send(()); })); self.sender .send(task) diff --git a/glean-core/src/lib.rs b/glean-core/src/lib.rs index 036e0402c7..983dc1a160 100644 --- a/glean-core/src/lib.rs +++ b/glean-core/src/lib.rs @@ -5,7 +5,6 @@ #![allow(clippy::significant_drop_in_scrutinee)] #![allow(clippy::uninlined_format_args)] #![deny(rustdoc::broken_intra_doc_links)] -#![deny(missing_docs)] //! Glean is a modern approach for recording and sending Telemetry data. //! @@ -37,7 +36,7 @@ mod core_metrics; mod coverage; mod database; mod debug; -mod dispatcher; +pub mod dispatcher; mod error; mod error_recording; mod event_database; @@ -593,12 +592,9 @@ pub fn shutdown() { .shutdown_dispatcher_wait .start_sync() }); - if dispatcher::block_on_queue_timeout(Duration::from_secs(10)).is_err() { - log::error!( - "Timeout while blocking on the dispatcher. No further shutdown cleanup will happen." - ); - return; - } + let blocked = dispatcher::block_on_queue_timeout(Duration::from_secs(10)); + + // Always record the dispatcher wait, regardless of the timeout. let stop_time = time::precise_time_ns(); core::with_glean(|glean| { glean @@ -606,6 +602,12 @@ pub fn shutdown() { .shutdown_dispatcher_wait .set_stop_and_accumulate(glean, timer_id, stop_time); }); + if blocked.is_err() { + log::error!( + "Timeout while blocking on the dispatcher. No further shutdown cleanup will happen." + ); + return; + } if let Err(e) = dispatcher::shutdown() { log::error!("Can't shutdown dispatcher thread: {:?}", e); From f405b2dab83cd8e047fd24155ea64c9af7f14b61 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Fri, 16 Jun 2023 15:21:58 +0200 Subject: [PATCH 62/74] Python: Use specific MarkupSafe version for development This is the most recent version we support (in glean_parser), but other dependencies pulled in a newer version, which under the wrong circumstances lead to a failure installing and building all the dependencies. --- glean-core/python/requirements_dev.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/glean-core/python/requirements_dev.txt b/glean-core/python/requirements_dev.txt index 335be320c7..a462cab25d 100644 --- a/glean-core/python/requirements_dev.txt +++ b/glean-core/python/requirements_dev.txt @@ -8,6 +8,7 @@ mypy==1.3.0; python_version > '3.6' pdoc3==0.10.0 pip pytest-localserver==0.7.1 +MarkupSafe==2.0.1 pytest-runner==5.3.1 pytest==7.0.1 semver==2.13.0 From fcc2b5422bcd7a7d9a7665f6efb949c7c792cd6d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Jun 2023 08:51:07 -0500 Subject: [PATCH 63/74] Bump mypy from 1.3.0 to 1.4.0 in /glean-core/python (#2509) Bumps [mypy](https://github.com/python/mypy) from 1.3.0 to 1.4.0. - [Commits](https://github.com/python/mypy/compare/v1.3.0...v1.4.0) --- updated-dependencies: - dependency-name: mypy dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- glean-core/python/requirements_dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glean-core/python/requirements_dev.txt b/glean-core/python/requirements_dev.txt index a462cab25d..5d38e9ee4e 100644 --- a/glean-core/python/requirements_dev.txt +++ b/glean-core/python/requirements_dev.txt @@ -4,7 +4,7 @@ coverage==7.2.2; python_version > '3.6' flake8==6.0.0; python_version >= '3.8' flake8-bugbear==23.6.5; python_version >= '3.8' jsonschema==3.2.0 -mypy==1.3.0; python_version > '3.6' +mypy==1.4.0; python_version > '3.6' pdoc3==0.10.0 pip pytest-localserver==0.7.1 From 07eb2110cc45069fdcfa42087b88052039ab9ea3 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Mon, 19 Jun 2023 16:17:18 +0200 Subject: [PATCH 64/74] Add helper script to run tests of the Python wheel on Linux [docs only] --- .gitignore | 3 +++ bin/build-win.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100755 bin/build-win.sh diff --git a/.gitignore b/.gitignore index 8f65779933..24e8158338 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,9 @@ raw_xcode*log *.egg-info dist/ +# Wine stuff +winpython/ + samples/ios/app/.venv/ .mypy_cache/ .coverage diff --git a/bin/build-win.sh b/bin/build-win.sh new file mode 100755 index 0000000000..72af055b6b --- /dev/null +++ b/bin/build-win.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +if ! command -v wine64 >/dev/null; then + echo "wine64 required." + echo "Use your package manager to install it." + exit 1 +fi + +if ! python3 --version | grep -q 3.8; then + echo "Python 3.8 required." + echo "Use pyenv or your package manager to install it." + exit 1 +fi + +if ! command -v x86_64-w64-mingw32-gcc >/dev/null; then + echo "x86_64-w64-mingw32-gcc not found." + echo "Install mingw64 using your package manger." + exit 1 +fi + +set -e # exit on failure +set -x # show all commands + +make setup-python +pushd glean-core/python +GLEAN_BUILD_TARGET=x86_64-pc-windows-gnu \ +GLEAN_BUILD_VARIANT=release \ + .venv3.8/bin/python3 setup.py bdist_wheel +popd + +export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$(command -v x86_64-w64-mingw32-gcc)" +export WINPYTHON="wine64 winpython/python.exe" +export WINEDEBUG=-all + +if [ ! -d "winpython" ]; then + mkdir winpython + + wget https://www.python.org/ftp/python/3.8.2/python-3.8.2-embed-amd64.zip -O winpython/python-3.8.2-embed-amd64.zip + unzip winpython/python-3.8.2-embed-amd64.zip -d winpython +fi + +if [ ! -f "winpython/Scripts/pip.exe" ]; then + wget https://bootstrap.pypa.io/get-pip.py -O winpython/get-pip.py + $WINPYTHON winpython/get-pip.py + echo "import site" >> winpython/python38._pth + echo "import sys; sys.path.insert(0, '')" >> winpython/sitecustomize.py +fi + +# The Windows-Python-installed-inside-Wine thing can't actually build wheels, +# so just install all of the wheels that were created as part of creating the +# environment on the host system before attempting to install everything in +# requirements_dev.txt +find ~/.cache/pip -name "*win_amd64.whl" -exec $WINPYTHON -m pip install {} \; +$WINPYTHON -m pip install -r glean-core/python/requirements_dev.txt --no-warn-script-location +$WINPYTHON -m pip install glean-core/python/dist/*win_amd64.whl --no-warn-script-location + +# run tests +$WINPYTHON -m pytest -s glean-core/python/tests From 1ad5de628b9359cda53412de6ca6bfe6d6b019e6 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Mon, 26 Jun 2023 14:47:49 +0200 Subject: [PATCH 65/74] Swift: Upgrade to swiftlint 0.52 and address new warnings --- .circleci/config.yml | 5 +++-- .swiftlint.yml | 3 +++ glean-core/ios/Glean/Metrics/LabeledMetric.swift | 2 -- glean-core/ios/Glean/Utils/Sysctl.swift | 5 ++--- .../ios/GleanTests/Metrics/DatetimeMetricTypeTests.swift | 1 + glean-core/ios/GleanTests/Metrics/EventMetricTests.swift | 2 -- glean-core/ios/GleanTests/Metrics/LabeledMetricTests.swift | 2 -- glean-core/ios/GleanTests/Net/BaselinePingTests.swift | 2 -- glean-core/ios/GleanTests/Net/DeletionRequestPingTests.swift | 2 -- .../ios/app/glean-sample-appUITests/BaselinePingTest.swift | 2 -- .../glean-sample-appUITests/DeletionRequestPingTest.swift | 2 -- samples/ios/app/glean-sample-appUITests/EventPingTest.swift | 2 -- .../ios/app/glean-sample-appUITests/ViewControllerTest.swift | 2 -- 13 files changed, 9 insertions(+), 23 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 615a8b7610..eeebef2186 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -489,8 +489,9 @@ jobs: name: Install lint tools command: | export HOMEBREW_NO_AUTO_UPDATE=1 - # swiftlint 0.50.1 - curl https://raw.githubusercontent.com/Homebrew/homebrew-core/dd10ef27e1327dd3dfc6f428565a83402d4abc24/Formula/swiftlint.rb > swiftlint.rb + export HOMEBREW_NO_INSTALL_CLEANUP=1 + # swiftlint 0.52.3 + curl https://raw.githubusercontent.com/Homebrew/homebrew-core/a8712178bbbd19247abab91f3fb2eae240f8249c/Formula/swiftlint.rb > swiftlint.rb brew install ./swiftlint.rb - run: name: Run swiftlint diff --git a/.swiftlint.yml b/.swiftlint.yml index 10ab1ccbc5..dfd533da6f 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -8,6 +8,9 @@ disabled_rules: # We're pretty careful about this already, but it's a pain to disable # and reenable in the cases where we're sure. - force_try + # We're pretty careful about this already, but it's a pain to disable + # and reenable in the cases where we're sure (mostly tests). + - force_cast # We'll get to these when we get to them! - todo diff --git a/glean-core/ios/Glean/Metrics/LabeledMetric.swift b/glean-core/ios/Glean/Metrics/LabeledMetric.swift index 886599f76b..ff148b9663 100644 --- a/glean-core/ios/Glean/Metrics/LabeledMetric.swift +++ b/glean-core/ios/Glean/Metrics/LabeledMetric.swift @@ -73,8 +73,6 @@ public class LabeledMetricType { /// * label: The label /// - returns: The specific metric for that label public subscript(label: String) -> T { - // swiftlint:disable force_cast - // REASON: We return the same type as the `subMetric` we match against switch self.inner { case is LabeledCounter: diff --git a/glean-core/ios/Glean/Utils/Sysctl.swift b/glean-core/ios/Glean/Utils/Sysctl.swift index 28d8dd8fcd..ffbb078667 100644 --- a/glean-core/ios/Glean/Utils/Sysctl.swift +++ b/glean-core/ios/Glean/Utils/Sysctl.swift @@ -25,9 +25,6 @@ import Foundation -// swiftlint:disable force_try -// REASON: Used on infallible operations - /// A "static"-only namespace around a series of functions that operate on buffers returned from the `Darwin.sysctl` function struct Sysctl { /// Possible errors. @@ -162,3 +159,5 @@ struct Sysctl { return (try? Sysctl.string(for: [CTL_KERN, KERN_OSVERSION])) ?? "Unknown" } } + +// swiftlint:enable line_length diff --git a/glean-core/ios/GleanTests/Metrics/DatetimeMetricTypeTests.swift b/glean-core/ios/GleanTests/Metrics/DatetimeMetricTypeTests.swift index 786c6c45db..00bd7d37b8 100644 --- a/glean-core/ios/GleanTests/Metrics/DatetimeMetricTypeTests.swift +++ b/glean-core/ios/GleanTests/Metrics/DatetimeMetricTypeTests.swift @@ -42,6 +42,7 @@ class DatetimeMetricTypeTests: XCTestCase { let date1 = Date.fromISO8601String(dateString: testString, precision: metric.timeUnit) XCTAssertEqual(date1, metric.testGetValue()) } + // swiftlint:enable function_parameter_count func testDatetimeSavesToStorage() { let datetimeMetric = DatetimeMetricType(CommonMetricData( diff --git a/glean-core/ios/GleanTests/Metrics/EventMetricTests.swift b/glean-core/ios/GleanTests/Metrics/EventMetricTests.swift index 2b3b56def9..bcb142c4ed 100644 --- a/glean-core/ios/GleanTests/Metrics/EventMetricTests.swift +++ b/glean-core/ios/GleanTests/Metrics/EventMetricTests.swift @@ -57,8 +57,6 @@ struct SomeExtras: EventExtras { } } -// swiftlint:disable force_cast -// REASON: Used in a test class EventMetricTypeTests: XCTestCase { var expectation: XCTestExpectation? var lastPingJson: [String: Any]? diff --git a/glean-core/ios/GleanTests/Metrics/LabeledMetricTests.swift b/glean-core/ios/GleanTests/Metrics/LabeledMetricTests.swift index 12cf447ff7..31fadc5c83 100644 --- a/glean-core/ios/GleanTests/Metrics/LabeledMetricTests.swift +++ b/glean-core/ios/GleanTests/Metrics/LabeledMetricTests.swift @@ -5,8 +5,6 @@ @testable import Glean import XCTest -// swiftlint:disable force_cast -// REASON: Used in a test class LabeledMetricTypeTests: XCTestCase { override func setUp() { resetGleanDiscardingInitialPings(testCase: self, tag: "LabeledMetricTypeTests") diff --git a/glean-core/ios/GleanTests/Net/BaselinePingTests.swift b/glean-core/ios/GleanTests/Net/BaselinePingTests.swift index 6fd6a7abe6..25a8d91be6 100644 --- a/glean-core/ios/GleanTests/Net/BaselinePingTests.swift +++ b/glean-core/ios/GleanTests/Net/BaselinePingTests.swift @@ -128,7 +128,6 @@ final class BaselinePingTests: XCTestCase { } */ - // swiftlint:disable force_cast func testSendingOfStartupBaselinePingWithAppLifetimeMetric() { // Set the dirty flag. gleanSetDirtyFlag(true) @@ -179,5 +178,4 @@ final class BaselinePingTests: XCTestCase { XCTAssertNil(error, "Test timed out waiting for upload: \(error!)") } } - // swiftlint:enable force_cast } diff --git a/glean-core/ios/GleanTests/Net/DeletionRequestPingTests.swift b/glean-core/ios/GleanTests/Net/DeletionRequestPingTests.swift index fb27f90395..76c143351b 100644 --- a/glean-core/ios/GleanTests/Net/DeletionRequestPingTests.swift +++ b/glean-core/ios/GleanTests/Net/DeletionRequestPingTests.swift @@ -5,8 +5,6 @@ @testable import Glean import XCTest -// swiftlint:disable force_cast -// REASON: Used in a test class DeletionRequestPingTests: XCTestCase { var expectation: XCTestExpectation? var lastPingJson: [String: Any]? diff --git a/samples/ios/app/glean-sample-appUITests/BaselinePingTest.swift b/samples/ios/app/glean-sample-appUITests/BaselinePingTest.swift index a6605244ed..2e198fc067 100644 --- a/samples/ios/app/glean-sample-appUITests/BaselinePingTest.swift +++ b/samples/ios/app/glean-sample-appUITests/BaselinePingTest.swift @@ -6,8 +6,6 @@ import Glean import Swifter import XCTest -// swiftlint:disable force_cast -// REASON: Used in below test cases to cause errors if data is missing class BaselinePingTest: XCTestCase { var app: XCUIApplication! var expectation: XCTestExpectation? diff --git a/samples/ios/app/glean-sample-appUITests/DeletionRequestPingTest.swift b/samples/ios/app/glean-sample-appUITests/DeletionRequestPingTest.swift index b253d1f88a..f2fab91373 100644 --- a/samples/ios/app/glean-sample-appUITests/DeletionRequestPingTest.swift +++ b/samples/ios/app/glean-sample-appUITests/DeletionRequestPingTest.swift @@ -6,8 +6,6 @@ import Glean import Swifter import XCTest -// swiftlint:disable force_cast -// REASON: Used in below test cases to cause errors if data is missing class DeletionRequestPingTest: XCTestCase { var app: XCUIApplication! var expectation: XCTestExpectation? diff --git a/samples/ios/app/glean-sample-appUITests/EventPingTest.swift b/samples/ios/app/glean-sample-appUITests/EventPingTest.swift index 85502cfcd5..86a2d4fd36 100644 --- a/samples/ios/app/glean-sample-appUITests/EventPingTest.swift +++ b/samples/ios/app/glean-sample-appUITests/EventPingTest.swift @@ -6,8 +6,6 @@ import Glean import Swifter import XCTest -// swiftlint:disable force_cast -// REASON: Used in below test cases to cause errors if data is missing class EventPingTest: XCTestCase { var app: XCUIApplication! var expectation: XCTestExpectation? diff --git a/samples/ios/app/glean-sample-appUITests/ViewControllerTest.swift b/samples/ios/app/glean-sample-appUITests/ViewControllerTest.swift index 0e17f86f1f..d8d04e10fd 100644 --- a/samples/ios/app/glean-sample-appUITests/ViewControllerTest.swift +++ b/samples/ios/app/glean-sample-appUITests/ViewControllerTest.swift @@ -6,8 +6,6 @@ import Glean import Swifter import XCTest -// swiftlint:disable force_cast -// REASON: Used in below test cases to cause errors if data is missing class ViewControllerTest: XCTestCase { var app: XCUIApplication! var expectation: XCTestExpectation? From 54aa0dfc525ac6c14d19c8f19ea4eb238d45b8b1 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Tue, 27 Jun 2023 13:16:53 +0200 Subject: [PATCH 66/74] Swift (testing): Use a simple string as HTTP response This ensures it's a known type and avoids the warning: "empty collection literal requires an explicit type" --- glean-core/ios/GleanTests/GleanTests.swift | 8 ++++---- glean-core/ios/GleanTests/TestUtils.swift | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/glean-core/ios/GleanTests/GleanTests.swift b/glean-core/ios/GleanTests/GleanTests.swift index d490952d69..30ded1b99b 100644 --- a/glean-core/ios/GleanTests/GleanTests.swift +++ b/glean-core/ios/GleanTests/GleanTests.swift @@ -160,9 +160,9 @@ class GleanTests: XCTestCase { } return HTTPStubsResponse( - jsonObject: [], + data: Data("OK".utf8), statusCode: 200, - headers: ["Content-Type": "application/json"] + headers: nil ) } @@ -198,9 +198,9 @@ class GleanTests: XCTestCase { } return HTTPStubsResponse( - jsonObject: [], + data: Data("OK".utf8), statusCode: 200, - headers: ["Content-Type": "application/json"] + headers: nil ) } diff --git a/glean-core/ios/GleanTests/TestUtils.swift b/glean-core/ios/GleanTests/TestUtils.swift index f8ed18c162..9568363a7b 100644 --- a/glean-core/ios/GleanTests/TestUtils.swift +++ b/glean-core/ios/GleanTests/TestUtils.swift @@ -37,9 +37,9 @@ func stubServerReceive(callback: @escaping (String, [String: Any]?) -> Void) { callback(pingType, payload) return HTTPStubsResponse( - jsonObject: [], + data: Data("OK".utf8), statusCode: 200, - headers: ["Content-Type": "application/json"] + headers: nil ) } } From 109b83709ea74888878d5d22244e5cc2ea827362 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Tue, 27 Jun 2023 16:36:58 +0200 Subject: [PATCH 67/74] Remove accidentally left-over debugging sleeps --- glean-core/rlb/examples/prototype.rs | 6 ------ glean-core/src/lib.rs | 3 ++- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/glean-core/rlb/examples/prototype.rs b/glean-core/rlb/examples/prototype.rs index 0e3ecc3909..630638cc59 100644 --- a/glean-core/rlb/examples/prototype.rs +++ b/glean-core/rlb/examples/prototype.rs @@ -57,14 +57,8 @@ fn main() { glean::initialize(cfg, client_info); glean_metrics::sample_boolean.set(true); - _ = glean_metrics::sample_boolean.test_get_value(None); PrototypePing.submit(None); - glean_core::dispatcher::launch(|| { - std::thread::sleep(std::time::Duration::from_secs(15)); - }); - glean::shutdown(); - std::thread::sleep(std::time::Duration::from_secs(10)); } diff --git a/glean-core/src/lib.rs b/glean-core/src/lib.rs index 983dc1a160..45198dd701 100644 --- a/glean-core/src/lib.rs +++ b/glean-core/src/lib.rs @@ -5,6 +5,7 @@ #![allow(clippy::significant_drop_in_scrutinee)] #![allow(clippy::uninlined_format_args)] #![deny(rustdoc::broken_intra_doc_links)] +#![deny(missing_docs)] //! Glean is a modern approach for recording and sending Telemetry data. //! @@ -36,7 +37,7 @@ mod core_metrics; mod coverage; mod database; mod debug; -pub mod dispatcher; +mod dispatcher; mod error; mod error_recording; mod event_database; From ef0d8ee61547f0f9b9c48ee5c542a1c2c5cfddb3 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Tue, 6 Jun 2023 14:32:48 +0200 Subject: [PATCH 68/74] Update to UniFFI 0.24.1 --- Cargo.lock | 113 ++++++++--------- deny.toml | 2 - glean-core/Cargo.toml | 4 +- supply-chain/audits.toml | 88 +++++++++++++ supply-chain/imports.lock | 146 +++++++++------------- tools/embedded-uniffi-bindgen/Cargo.toml | 3 +- tools/embedded-uniffi-bindgen/src/main.rs | 16 ++- 7 files changed, 211 insertions(+), 161 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cfc03c024e..97ea05072e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,24 +40,28 @@ checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" [[package]] name = "askama" -version = "0.11.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb98f10f371286b177db5eeb9a6e5396609555686a35e1d4f7b9a9c6d8af0139" +checksum = "47cbc3cf73fa8d9833727bbee4835ba5c421a0d65b72daf9a7b5d0e0f9cfb57e" dependencies = [ "askama_derive", "askama_escape", - "askama_shared", ] [[package]] name = "askama_derive" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87bf87e6e8b47264efa9bde63d6225c6276a52e05e91bf37eaa8afd0032d6b71" +checksum = "c22fbe0413545c098358e56966ff22cdd039e10215ae213cfbd65032b119fc94" dependencies = [ - "askama_shared", + "basic-toml", + "mime", + "mime_guess", + "nom", "proc-macro2", - "syn 1.0.105", + "quote", + "serde", + "syn", ] [[package]] @@ -66,29 +70,21 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" -[[package]] -name = "askama_shared" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf722b94118a07fcbc6640190f247334027685d4e218b794dbfe17c32bf38ed0" -dependencies = [ - "askama_escape", - "mime", - "mime_guess", - "nom", - "proc-macro2", - "quote", - "serde", - "syn 1.0.105", - "toml", -] - [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "basic-toml" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c0de75129aa8d0cceaf750b89013f0e08804d6ec61416da787b35ad0d7cddf1" +dependencies = [ + "serde", +] + [[package]] name = "bincode" version = "1.3.3" @@ -210,7 +206,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1586fa608b1dab41f667475b4a41faec5ba680aee428bfa5de4ea520fdc6e901" dependencies = [ "quote", - "syn 2.0.18", + "syn", ] [[package]] @@ -235,7 +231,7 @@ version = "0.1.0" dependencies = [ "anyhow", "camino", - "uniffi_bindgen", + "uniffi", ] [[package]] @@ -447,7 +443,7 @@ checksum = "20cc83c51f04b1ad3b24cbac53d2ec1a138d699caabe05d315cb8538e8624d01" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn", ] [[package]] @@ -817,13 +813,13 @@ dependencies = [ [[package]] name = "scroll_derive" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdbda6ac5cd1321e724fa9cee216f3a61885889b896f073b8f82322789c5250e" +checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" dependencies = [ "proc-macro2", "quote", - "syn 1.0.105", + "syn", ] [[package]] @@ -852,7 +848,7 @@ checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn", ] [[package]] @@ -878,17 +874,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "syn" -version = "1.0.105" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.18" @@ -945,7 +930,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn", ] [[package]] @@ -1015,11 +1000,12 @@ dependencies = [ [[package]] name = "uniffi" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f71cc01459bc34cfe43fabf32b39f1228709bc6db1b3a664a92940af3d062376" +checksum = "6da26ba712a8547207ededc70f3e0952c09754be9516c320f71731d2f18daf3e" dependencies = [ "anyhow", + "uniffi_bindgen", "uniffi_build", "uniffi_core", "uniffi_macros", @@ -1027,14 +1013,14 @@ dependencies = [ [[package]] name = "uniffi_bindgen" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbbba5103051c18f10b22f80a74439ddf7100273f217a547005d2735b2498994" +checksum = "29bff3ba24868022fc82e2f1558f3a0fdcc2655e1335459a35f25d1ec4ff1d0c" dependencies = [ "anyhow", "askama", - "bincode", "camino", + "cargo_metadata", "fs-err", "glob", "goblin", @@ -1051,9 +1037,9 @@ dependencies = [ [[package]] name = "uniffi_build" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1a28368ff3d83717e3d3e2e15a66269c43488c3f036914131bb68892f29fb" +checksum = "52b7cd03e17b997469e5438d1a491c3b9e2d41c2a87c86fd91ba96e87aecba6a" dependencies = [ "anyhow", "camino", @@ -1062,19 +1048,19 @@ dependencies = [ [[package]] name = "uniffi_checksum_derive" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03de61393a42b4ad4984a3763c0600594ac3e57e5aaa1d05cede933958987c03" +checksum = "af98d58e238b6aef9ff62a93b5c60caa710bdb49351434a639b9bd7b4c84c808" dependencies = [ "quote", - "syn 1.0.105", + "syn", ] [[package]] name = "uniffi_core" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2b4852d638d74ca2d70e450475efb6d91fe6d54a7cd8d6bd80ad2ee6cd7daa" +checksum = "68640fa1b5dfbb4ccc149057c81b40adc51a01d295ce798c15c6c76f7e899907" dependencies = [ "anyhow", "bytes", @@ -1088,9 +1074,9 @@ dependencies = [ [[package]] name = "uniffi_macros" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa03394de21e759e0022f1ea8d992d2e39290d735b9ed52b1f74b20a684f794e" +checksum = "76f72684ff48a8ff0ee95fde6dbcfa687236ad1789dc18205cb3305432a7b35c" dependencies = [ "bincode", "camino", @@ -1099,7 +1085,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 1.0.105", + "syn", "toml", "uniffi_build", "uniffi_meta", @@ -1107,20 +1093,23 @@ dependencies = [ [[package]] name = "uniffi_meta" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66fdab2c436aed7a6391bec64204ec33948bfed9b11b303235740771f85c4ea6" +checksum = "fe3388a58b13dad8f0cdcbdee1c59af6408608ce8d85a3ef5d1429369ca7b217" dependencies = [ + "anyhow", + "bytes", "serde", "siphasher", "uniffi_checksum_derive", + "uniffi_core", ] [[package]] name = "uniffi_testing" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92b0570953ec41d97ce23e3b92161ac18231670a1f97523258a6d2ab76d7f76c" +checksum = "4fb437a2c8565249274e381fd88bc75b539897f321b79022c9fe7e275d2c2bbb" dependencies = [ "anyhow", "camino", diff --git a/deny.toml b/deny.toml index 1f76024185..1211d13ae3 100644 --- a/deny.toml +++ b/deny.toml @@ -20,8 +20,6 @@ skip = [ # wasi 0.10 and 0.11 are allowed # (m-c patches 0.10 to 0.11) { name = "wasi", version = "0.11.0" }, - # Allow both syn v1 and v2 for the time being - { name = "syn", version = "1.0.105" }, ] # Avoid certain crates diff --git a/glean-core/Cargo.toml b/glean-core/Cargo.toml index 734cf1cec8..263539f7fe 100644 --- a/glean-core/Cargo.toml +++ b/glean-core/Cargo.toml @@ -40,7 +40,7 @@ flate2 = "1.0.19" zeitstempel = "0.1.0" crossbeam-channel = "0.5" thiserror = "1.0.4" -uniffi = { version = "0.23.0", default-features = false } +uniffi = { version = "0.24.1", default-features = false } time = "0.1.40" env_logger = { version = "0.10.0", default-features = false, optional = true } @@ -57,7 +57,7 @@ iso8601 = "0.4" ctor = "0.2.2" [build-dependencies] -uniffi = { version = "0.23.0", default-features = false, features = ["build"] } +uniffi = { version = "0.24.1", default-features = false, features = ["build"] } [features] # Increases the preinit queue limit to 10^6 diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml index 5f6dcbf4da..7fc10e9716 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml @@ -1,6 +1,70 @@ # cargo-vet audits file +[[wildcard-audits.uniffi]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +user-id = 48 +start = "2022-05-05" +end = "2024-06-21" +notes = "Maintained by the Glean and Application Services teams" + +[[wildcard-audits.uniffi_bindgen]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +user-id = 48 +start = "2022-05-05" +end = "2024-06-21" +notes = "Maintained by the Glean and Application Services teams" + +[[wildcard-audits.uniffi_build]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +user-id = 48 +start = "2022-05-05" +end = "2024-06-21" +notes = "Maintained by the Glean and Application Services teams" + +[[wildcard-audits.uniffi_checksum_derive]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +user-id = 48 +start = "2022-05-05" +end = "2024-06-21" +notes = "Maintained by the Glean and Application Services teams" + +[[wildcard-audits.uniffi_core]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +user-id = 48 +start = "2022-05-05" +end = "2024-06-21" +notes = "Maintained by the Glean and Application Services teams" + +[[wildcard-audits.uniffi_macros]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +user-id = 48 +start = "2022-05-05" +end = "2024-06-21" +notes = "Maintained by the Glean and Application Services teams" + +[[wildcard-audits.uniffi_meta]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +user-id = 48 +start = "2022-08-31" +end = "2024-06-21" +notes = "Maintained by the Glean and Application Services teams" + +[[wildcard-audits.uniffi_testing]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +user-id = 48 +start = "2022-05-05" +end = "2024-06-21" +notes = "Maintained by the Glean and Application Services teams" + [[wildcard-audits.zeitstempel]] who = "Jan-Erik Rediger " criteria = "safe-to-deploy" @@ -9,6 +73,24 @@ start = "2021-03-03" end = "2024-05-10" notes = "Maintained by me" +[[audits.askama]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +delta = "0.11.1 -> 0.12.0" +notes = "No new unsafe usage, mostly dependency updates and smaller API changes" + +[[audits.askama_derive]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +delta = "0.11.2 -> 0.12.1" +notes = "Dependency updates, a new toml dependency and some API changes. No unsafe use." + +[[audits.basic-toml]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +version = "0.1.2" +notes = "TOML parser, forked from toml 0.5" + [[audits.crossbeam-channel]] who = "Jan-Erik Rediger " criteria = "safe-to-deploy" @@ -45,6 +127,12 @@ criteria = "safe-to-deploy" delta = "1.0.27 -> 1.0.28" notes = "Enabled on wasm targets" +[[audits.scroll_derive]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +delta = "0.11.0 -> 0.11.1" +notes = "Dependency syn v2 update only" + [[audits.serde]] who = "Jan-Erik Rediger " criteria = "safe-to-deploy" diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock index 8b37459864..57f08158b8 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -1,6 +1,62 @@ # cargo-vet imports lock +[[publisher.uniffi]] +version = "0.24.1" +when = "2023-06-23" +user-id = 48 +user-login = "badboy" +user-name = "Jan-Erik Rediger" + +[[publisher.uniffi_bindgen]] +version = "0.24.1" +when = "2023-06-23" +user-id = 48 +user-login = "badboy" +user-name = "Jan-Erik Rediger" + +[[publisher.uniffi_build]] +version = "0.24.1" +when = "2023-06-23" +user-id = 48 +user-login = "badboy" +user-name = "Jan-Erik Rediger" + +[[publisher.uniffi_checksum_derive]] +version = "0.24.1" +when = "2023-06-23" +user-id = 48 +user-login = "badboy" +user-name = "Jan-Erik Rediger" + +[[publisher.uniffi_core]] +version = "0.24.1" +when = "2023-06-23" +user-id = 48 +user-login = "badboy" +user-name = "Jan-Erik Rediger" + +[[publisher.uniffi_macros]] +version = "0.24.1" +when = "2023-06-23" +user-id = 48 +user-login = "badboy" +user-name = "Jan-Erik Rediger" + +[[publisher.uniffi_meta]] +version = "0.24.1" +when = "2023-06-23" +user-id = 48 +user-login = "badboy" +user-name = "Jan-Erik Rediger" + +[[publisher.uniffi_testing]] +version = "0.24.1" +when = "2023-06-23" +user-id = 48 +user-login = "badboy" +user-name = "Jan-Erik Rediger" + [[publisher.zeitstempel]] version = "0.1.1" when = "2021-03-18" @@ -172,96 +228,6 @@ is similar to what it once was back then. Skimming over the crate there is nothing suspicious and it's everything you'd expect a Rust URL parser to be. """ -[[audits.bytecode-alliance.audits.windows-sys]] -who = "Dan Gohman " -criteria = "safe-to-deploy" -version = "0.42.0" -notes = "This is a Windows API bindings library maintained by Microsoft themselves." - -[[audits.bytecode-alliance.audits.windows_aarch64_gnullvm]] -who = "Dan Gohman " -criteria = "safe-to-deploy" -version = "0.42.0" -notes = "This is a Windows API bindings library maintained by Microsoft themselves." - -[[audits.bytecode-alliance.audits.windows_aarch64_gnullvm]] -who = "Pat Hickey " -criteria = "safe-to-deploy" -delta = "0.42.0 -> 0.42.1" -notes = "This is a Windows API bindings library maintained by Microsoft themselves. The diff is just adding license files." - -[[audits.bytecode-alliance.audits.windows_aarch64_msvc]] -who = "Dan Gohman " -criteria = "safe-to-deploy" -version = "0.42.0" -notes = "This is a Windows API bindings library maintained by Microsoft themselves." - -[[audits.bytecode-alliance.audits.windows_aarch64_msvc]] -who = "Pat Hickey " -criteria = "safe-to-deploy" -delta = "0.42.0 -> 0.42.1" -notes = "This is a Windows API bindings library maintained by Microsoft themselves. The diff is just adding license files." - -[[audits.bytecode-alliance.audits.windows_i686_gnu]] -who = "Dan Gohman " -criteria = "safe-to-deploy" -version = "0.42.0" -notes = "This is a Windows API bindings library maintained by Microsoft themselves." - -[[audits.bytecode-alliance.audits.windows_i686_gnu]] -who = "Pat Hickey " -criteria = "safe-to-deploy" -delta = "0.42.0 -> 0.42.1" -notes = "This is a Windows API bindings library maintained by Microsoft themselves. The diff is just adding license files." - -[[audits.bytecode-alliance.audits.windows_i686_msvc]] -who = "Dan Gohman " -criteria = "safe-to-deploy" -version = "0.42.0" -notes = "This is a Windows API bindings library maintained by Microsoft themselves." - -[[audits.bytecode-alliance.audits.windows_i686_msvc]] -who = "Pat Hickey " -criteria = "safe-to-deploy" -delta = "0.42.0 -> 0.42.1" -notes = "This is a Windows API bindings library maintained by Microsoft themselves. The diff is just adding license files." - -[[audits.bytecode-alliance.audits.windows_x86_64_gnu]] -who = "Dan Gohman " -criteria = "safe-to-deploy" -version = "0.42.0" -notes = "This is a Windows API bindings library maintained by Microsoft themselves." - -[[audits.bytecode-alliance.audits.windows_x86_64_gnu]] -who = "Pat Hickey " -criteria = "safe-to-deploy" -delta = "0.42.0 -> 0.42.1" -notes = "This is a Windows API bindings library maintained by Microsoft themselves. The diff is just adding license files." - -[[audits.bytecode-alliance.audits.windows_x86_64_gnullvm]] -who = "Dan Gohman " -criteria = "safe-to-deploy" -version = "0.42.0" -notes = "This is a Windows API bindings library maintained by Microsoft themselves." - -[[audits.bytecode-alliance.audits.windows_x86_64_gnullvm]] -who = "Pat Hickey " -criteria = "safe-to-deploy" -delta = "0.42.0 -> 0.42.1" -notes = "This is a Windows API bindings library maintained by Microsoft themselves. The diff is just adding license files." - -[[audits.bytecode-alliance.audits.windows_x86_64_msvc]] -who = "Dan Gohman " -criteria = "safe-to-deploy" -version = "0.42.0" -notes = "This is a Windows API bindings library maintained by Microsoft themselves." - -[[audits.bytecode-alliance.audits.windows_x86_64_msvc]] -who = "Pat Hickey " -criteria = "safe-to-deploy" -delta = "0.42.0 -> 0.42.1" -notes = "This is a Windows API bindings library maintained by Microsoft themselves. The diff is just adding license files." - [[audits.chromeos.audits.ctor]] who = "George Burgess IV " criteria = "safe-to-run" diff --git a/tools/embedded-uniffi-bindgen/Cargo.toml b/tools/embedded-uniffi-bindgen/Cargo.toml index 50c7658cee..65bccb7ae4 100644 --- a/tools/embedded-uniffi-bindgen/Cargo.toml +++ b/tools/embedded-uniffi-bindgen/Cargo.toml @@ -9,5 +9,4 @@ publish = false [dependencies] anyhow = "1" camino = "1.1.1" -# TODO: Depend on `uniffi`, but avoid the clap dependency. -uniffi_bindgen = { version = "0.23.0", default-features = false } +uniffi = { version = "0.24.1", default-features = false, features = ["bindgen"] } diff --git a/tools/embedded-uniffi-bindgen/src/main.rs b/tools/embedded-uniffi-bindgen/src/main.rs index c87e34f390..10b8e04c14 100644 --- a/tools/embedded-uniffi-bindgen/src/main.rs +++ b/tools/embedded-uniffi-bindgen/src/main.rs @@ -6,7 +6,16 @@ use std::env; use anyhow::{bail, Context}; use camino::Utf8PathBuf; -use uniffi_bindgen::generate_bindings; +use uniffi::{generate_bindings, TargetLanguage}; + +fn parse_language(lang: &str) -> anyhow::Result { + match lang { + "kotlin" => Ok(TargetLanguage::Kotlin), + "python" => Ok(TargetLanguage::Python), + "swift" => Ok(TargetLanguage::Swift), + _ => bail!("Unknown language"), + } +} fn main() -> anyhow::Result<()> { let mut args = env::args().skip(1); @@ -23,7 +32,9 @@ fn main() -> anyhow::Result<()> { if let Some(arg) = arg.strip_prefix("--") { match arg { "language" => { - target_languages.push(args.next().context("--language needs a parameter")?) + let lang = args.next().context("--language needs a parameter")?; + let lang = parse_language(&lang)?; + target_languages.push(lang); } "out-dir" => out_dir = Some(args.next().context("--out-dir needs a parameter")?), "no-format" => { @@ -38,7 +49,6 @@ fn main() -> anyhow::Result<()> { } } - let target_languages: Vec<&str> = target_languages.iter().map(|s| &s[..]).collect(); let out_dir = out_dir.map(Utf8PathBuf::from); if udl_file.is_none() { From f5cbefb72327473090f62ab56678b8929c6405db Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Wed, 21 Jun 2023 13:27:38 +0200 Subject: [PATCH 69/74] Audit exemption for windows crates --- supply-chain/config.toml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/supply-chain/config.toml b/supply-chain/config.toml index c60cae930f..f3464c6085 100644 --- a/supply-chain/config.toml +++ b/supply-chain/config.toml @@ -332,6 +332,42 @@ criteria = "safe-to-deploy" version = "0.4.0" criteria = "safe-to-deploy" +[[exemptions.windows-sys]] +version = "0.42.0" +criteria = "safe-to-deploy" + +[[exemptions.windows_aarch64_gnullvm]] +version = "0.42.1" +criteria = "safe-to-deploy" + +[[exemptions.windows_aarch64_msvc]] +version = "0.42.1" +criteria = "safe-to-deploy" + +[[exemptions.windows_aarch64_msvc]] +version = "0.42.1" +criteria = "safe-to-deploy" + +[[exemptions.windows_i686_gnu]] +version = "0.42.1" +criteria = "safe-to-deploy" + +[[exemptions.windows_i686_msvc]] +version = "0.42.1" +criteria = "safe-to-deploy" + +[[exemptions.windows_x86_64_gnu]] +version = "0.42.1" +criteria = "safe-to-deploy" + +[[exemptions.windows_x86_64_gnullvm]] +version = "0.42.1" +criteria = "safe-to-deploy" + +[[exemptions.windows_x86_64_msvc]] +version = "0.42.1" +criteria = "safe-to-deploy" + [[exemptions.xshell]] version = "0.2.2" criteria = "safe-to-deploy" From fb5e29595789c86c4007e7fb6ca8a1c38a19e85a Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Wed, 21 Jun 2023 13:35:27 +0200 Subject: [PATCH 70/74] vet import --- supply-chain/config.toml | 26 +--- supply-chain/imports.lock | 276 +++++--------------------------------- 2 files changed, 38 insertions(+), 264 deletions(-) diff --git a/supply-chain/config.toml b/supply-chain/config.toml index f3464c6085..82d139dc64 100644 --- a/supply-chain/config.toml +++ b/supply-chain/config.toml @@ -7,12 +7,12 @@ version = "0.6" [imports.bytecode-alliance] url = "https://raw.githubusercontent.com/bytecodealliance/wasmtime/main/supply-chain/audits.toml" -[imports.chromeos] -url = "https://chromium.googlesource.com/chromiumos/third_party/rust_crates/+/main/cargo-vet/audits.toml?format=TEXT" - [imports.embark-studios] url = "https://raw.githubusercontent.com/EmbarkStudios/rust-ecosystem/main/audits.toml" +[imports.google] +url = "https://raw.githubusercontent.com/google/supply-chain/main/audits.toml" + [imports.isrg] url = "https://raw.githubusercontent.com/divviup/libprio-rs/main/supply-chain/audits.toml" @@ -44,10 +44,6 @@ criteria = "safe-to-deploy" version = "0.10.3" criteria = "safe-to-deploy" -[[exemptions.askama_shared]] -version = "0.12.2" -criteria = "safe-to-deploy" - [[exemptions.bincode]] version = "1.3.3" criteria = "safe-to-deploy" @@ -96,10 +92,6 @@ criteria = "safe-to-deploy" version = "0.2.8" criteria = "safe-to-deploy" -[[exemptions.errno-dragonfly]] -version = "0.1.2" -criteria = "safe-to-deploy" - [[exemptions.fastrand]] version = "1.7.0" criteria = "safe-to-deploy" @@ -116,10 +108,6 @@ criteria = "safe-to-deploy" version = "0.2.8" criteria = "safe-to-deploy" -[[exemptions.glob]] -version = "0.3.0" -criteria = "safe-to-deploy" - [[exemptions.goblin]] version = "0.6.0" criteria = "safe-to-deploy" @@ -280,10 +268,6 @@ criteria = "safe-to-deploy" version = "1.1.0" criteria = "safe-to-deploy" -[[exemptions.syn]] -version = "1.0.105" -criteria = "safe-to-deploy" - [[exemptions.syn]] version = "2.0.18" criteria = "safe-to-deploy" @@ -344,10 +328,6 @@ criteria = "safe-to-deploy" version = "0.42.1" criteria = "safe-to-deploy" -[[exemptions.windows_aarch64_msvc]] -version = "0.42.1" -criteria = "safe-to-deploy" - [[exemptions.windows_i686_gnu]] version = "0.42.1" criteria = "safe-to-deploy" diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock index 57f08158b8..1830e1d6c7 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -95,6 +95,12 @@ criteria = "safe-to-deploy" version = "1.0.0" notes = "I am the author of this crate." +[[audits.bytecode-alliance.audits.errno-dragonfly]] +who = "Jamey Sharp " +criteria = "safe-to-deploy" +version = "0.1.2" +notes = "This should be portable to any POSIX system and seems like it should be part of the libc crate, but at any rate it's safe as is." + [[audits.bytecode-alliance.audits.form_urlencoded]] who = "Alex Crichton " criteria = "safe-to-deploy" @@ -105,6 +111,11 @@ more than what it says on the tin. Contains one `unsafe` block related to performance around utf-8 validation which is fairly easy to verify as correct. """ +[[audits.bytecode-alliance.audits.glob]] +who = "Jamey Sharp " +criteria = "safe-to-deploy" +delta = "0.3.1 -> 0.3.0" + [[audits.bytecode-alliance.audits.heck]] who = "Alex Crichton " criteria = "safe-to-deploy" @@ -228,21 +239,6 @@ is similar to what it once was back then. Skimming over the crate there is nothing suspicious and it's everything you'd expect a Rust URL parser to be. """ -[[audits.chromeos.audits.ctor]] -who = "George Burgess IV " -criteria = "safe-to-run" -version = "0.1.26" - -[[audits.chromeos.audits.textwrap]] -who = "ChromeOS" -criteria = "safe-to-run" -version = "0.15.2" - -[[audits.chromeos.audits.version_check]] -who = "George Burgess IV " -criteria = "safe-to-deploy" -version = "0.9.4" - [[audits.embark-studios.audits.anyhow]] who = "Johan Andersson " criteria = "safe-to-deploy" @@ -266,6 +262,30 @@ criteria = "safe-to-deploy" version = "1.0.40" notes = "Found no unsafe or ambient capabilities used" +[[audits.google.audits.ctor]] +who = "George Burgess IV " +criteria = "safe-to-run" +version = "0.1.26" +aggregated-from = "https://chromium.googlesource.com/chromiumos/third_party/rust_crates/+/refs/heads/main/cargo-vet/audits.toml?format=TEXT" + +[[audits.google.audits.glob]] +who = "George Burgess IV " +criteria = "safe-to-deploy" +version = "0.3.1" +aggregated-from = "https://chromium.googlesource.com/chromiumos/third_party/rust_crates/+/refs/heads/main/cargo-vet/audits.toml?format=TEXT" + +[[audits.google.audits.textwrap]] +who = "ChromeOS" +criteria = "safe-to-run" +version = "0.15.2" +aggregated-from = "https://chromium.googlesource.com/chromiumos/third_party/rust_crates/+/refs/heads/main/cargo-vet/audits.toml?format=TEXT" + +[[audits.google.audits.version_check]] +who = "George Burgess IV " +criteria = "safe-to-deploy" +version = "0.9.4" +aggregated-from = "https://chromium.googlesource.com/chromiumos/third_party/rust_crates/+/refs/heads/main/cargo-vet/audits.toml?format=TEXT" + [[audits.isrg.audits.once_cell]] who = "Brandon Pitman " criteria = "safe-to-deploy" @@ -535,232 +555,6 @@ criteria = "safe-to-deploy" delta = "0.1.21 -> 0.1.22" aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" -[[audits.mozilla.audits.uniffi]] -who = "Travis Long " -criteria = "safe-to-deploy" -version = "0.19.3" -notes = "Maintained by the Glean and Application Services teams" -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -delta = "0.19.3 -> 0.19.6" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi]] -who = "Perry McManis " -criteria = "safe-to-deploy" -delta = "0.19.6 -> 0.20.0" -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -delta = "0.20.0 -> 0.21.0" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi]] -who = "Mike Hommey " -criteria = "safe-to-deploy" -delta = "0.21.0 -> 0.21.1" -notes = "No changes." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -delta = "0.21.1 -> 0.23.0" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_bindgen]] -who = "Travis Long " -criteria = "safe-to-deploy" -version = "0.19.3" -notes = "Maintained by the Glean and Application Services teams." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_bindgen]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -delta = "0.19.3 -> 0.19.6" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_bindgen]] -who = "Perry McManis " -criteria = "safe-to-deploy" -delta = "0.19.6 -> 0.20.0" -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_bindgen]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -delta = "0.20.0 -> 0.21.0" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_bindgen]] -who = "Mike Hommey " -criteria = "safe-to-deploy" -delta = "0.21.0 -> 0.21.1" -notes = "I authored the changes in this version." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_bindgen]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -delta = "0.21.1 -> 0.23.0" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_build]] -who = "Travis Long " -criteria = "safe-to-deploy" -version = "0.19.3" -notes = "Maintained by the Glean and Application Services teams." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_build]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -delta = "0.19.3 -> 0.19.6" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_build]] -who = "Perry McManis " -criteria = "safe-to-deploy" -delta = "0.19.6 -> 0.20.0" -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_build]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -delta = "0.20.0 -> 0.21.0" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_build]] -who = "Mike Hommey " -criteria = "safe-to-deploy" -delta = "0.21.0 -> 0.21.1" -notes = "No changes." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_build]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -delta = "0.21.1 -> 0.23.0" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_checksum_derive]] -who = "Mike Hommey " -criteria = "safe-to-deploy" -version = "0.21.1" -notes = "I authored this crate." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_checksum_derive]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -delta = "0.21.1 -> 0.23.0" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_core]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -version = "0.23.0" -notes = "Maintained by the Glean and Application Services teams." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_macros]] -who = "Travis Long " -criteria = "safe-to-deploy" -version = "0.19.3" -notes = "Maintained by the Glean and Application Services teams." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_macros]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -delta = "0.19.3 -> 0.19.6" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_macros]] -who = "Perry McManis " -criteria = "safe-to-deploy" -delta = "0.19.6 -> 0.20.0" -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_macros]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -delta = "0.20.0 -> 0.21.0" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_macros]] -who = "Mike Hommey " -criteria = "safe-to-deploy" -delta = "0.21.0 -> 0.21.1" -notes = "No changes." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_macros]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -delta = "0.21.1 -> 0.23.0" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_meta]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -version = "0.19.6" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_meta]] -who = "Perry McManis " -criteria = "safe-to-deploy" -delta = "0.19.6 -> 0.20.0" -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_meta]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -delta = "0.20.0 -> 0.21.0" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_meta]] -who = "Mike Hommey " -criteria = "safe-to-deploy" -delta = "0.21.0 -> 0.21.1" -notes = "I authored the changes in this version." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_meta]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -delta = "0.21.1 -> 0.23.0" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - -[[audits.mozilla.audits.uniffi_testing]] -who = "Jan-Erik Rediger " -criteria = "safe-to-deploy" -version = "0.23.0" -notes = "Maintained by the Glean and Application Services team." -aggregated-from = "https://hg.mozilla.org/mozilla-central/raw-file/tip/supply-chain/audits.toml" - [[audits.mozilla.audits.weedle2]] who = "Travis Long " criteria = "safe-to-deploy" From a1c111d4e5869dcc692db8b347f5d9e2bc072bdc Mon Sep 17 00:00:00 2001 From: Chris H-C Date: Thu, 22 Jun 2023 16:28:54 -0400 Subject: [PATCH 71/74] bug 1839433 - Try blocking shutdown 10s for init to complete --- glean-core/src/lib.rs | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/glean-core/src/lib.rs b/glean-core/src/lib.rs index 45198dd701..01c61a437b 100644 --- a/glean-core/src/lib.rs +++ b/glean-core/src/lib.rs @@ -474,6 +474,10 @@ fn initialize_inner( }); // Signal Dispatcher that init is complete + // bug 1839433: It is important that this happens after any init tasks + // that shutdown() depends on. At time of writing that's only setting up + // the global Glean, but it is probably best to flush the preinit queue + // as late as possible in the glean.init thread. match dispatcher::flush_init() { Ok(task_count) if task_count > 0 => { core::with_glean(|glean| { @@ -563,19 +567,45 @@ fn uploader_shutdown() { /// Shuts down Glean in an orderly fashion. pub fn shutdown() { - // Either init was never called or Glean was not fully initialized - // (e.g. due to an error). - // There's the potential that Glean is not initialized _yet_, - // but in progress. That's fine, we shutdown either way before doing any work. - if !was_initialize_called() || core::global_glean().is_none() { + // Shutdown might have been called + // 1) Before init was called + // * (data loss, oh well. Not enough time to do squat) + // 2) After init was called, but before it completed + // * (we're willing to wait a little bit for init to complete) + // 3) After init completed + // * (we can shut down immediately) + + // Case 1: "Before init was called" + if !was_initialize_called() { log::warn!("Shutdown called before Glean is initialized"); if let Err(e) = dispatcher::kill() { log::error!("Can't kill dispatcher thread: {:?}", e); } + return; + } + // Case 2: "After init was called, but before it completed" + if core::global_glean().is_none() { + log::warn!("Shutdown called before Glean is initialized. Waiting."); + // We can't join on the `glean.init` thread because there's no (easy) way + // to do that with a timeout. Instead, we wait for the preinit queue to + // empty, which is the last meaningful thing we do on that thread. + + // TODO: Make the timeout configurable? + // We don't need the return value, as we're less interested in whether + // this times out than we are in whether there's a Global Glean at the end. + let _ = dispatcher::block_on_queue_timeout(Duration::from_secs(10)); + } + // We can't shut down Glean if there's no Glean to shut down. + if core::global_glean().is_none() { + log::warn!("Waiting for Glean initialization timed out. Exiting."); + if let Err(e) = dispatcher::kill() { + log::error!("Can't kill dispatcher thread: {:?}", e); + } return; } + // Case 3: "After init completed" crate::launch_with_glean_mut(|glean| { glean.cancel_metrics_ping_scheduler(); glean.set_dirty_flag(false); From 7ea358b83f56c03d6a0a92429309e75cae814dda Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Wed, 28 Jun 2023 10:47:28 +0200 Subject: [PATCH 72/74] Add new changelog entries --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e5cdf8e83..2e592fd681 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ * General * Gracefully handle the waiting thread going away during shutdown ([#2503](https://github.com/mozilla/glean/pull/2503)) + * Updated to UniFFI 0.24.1 ([#2510](https://github.com/mozilla/glean/pull/2510)) + * Try blocking shutdown 10s for init to complete ([#2518](https://github.com/mozilla/glean/pull/2518)) * Android * Update minimum supported Java byte code generation to 17 ([#2498](https://github.com/mozilla/glean/pull/2498/)) From 26feb193a0a7de1a47d35d912f27792221fa4bcf Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Wed, 28 Jun 2023 10:53:17 +0200 Subject: [PATCH 73/74] Bumped version to 53.1.0 --- .buildconfig.yml | 2 +- CHANGELOG.md | 6 +- Cargo.lock | 4 +- DEPENDENCIES.md | 415 +++++++++++++----- about.toml | 1 + glean-core/Cargo.toml | 2 +- .../android-native/dependency-licenses.xml | 91 ++-- glean-core/android/dependency-licenses.xml | 91 ++-- glean-core/python/setup.py | 2 +- glean-core/rlb/Cargo.toml | 4 +- .../GleanGradlePlugin.groovy | 2 +- 11 files changed, 391 insertions(+), 229 deletions(-) diff --git a/.buildconfig.yml b/.buildconfig.yml index 448f15e0d1..b11cb1510d 100644 --- a/.buildconfig.yml +++ b/.buildconfig.yml @@ -1,4 +1,4 @@ -libraryVersion: 53.0.0 +libraryVersion: 53.1.0 groupId: org.mozilla.telemetry projects: glean: diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e592fd681..005f4076e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Unreleased changes -[Full changelog](https://github.com/mozilla/glean/compare/v53.0.0...main) +[Full changelog](https://github.com/mozilla/glean/compare/v53.1.0...main) + +# v53.1.0 (2023-06-28) + +[Full changelog](https://github.com/mozilla/glean/compare/v53.0.0...v53.1.0) * General * Gracefully handle the waiting thread going away during shutdown ([#2503](https://github.com/mozilla/glean/pull/2503)) diff --git a/Cargo.lock b/Cargo.lock index 97ea05072e..16d4bc65f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -314,7 +314,7 @@ dependencies = [ [[package]] name = "glean" -version = "53.0.0" +version = "53.1.0" dependencies = [ "chrono", "crossbeam-channel", @@ -357,7 +357,7 @@ dependencies = [ [[package]] name = "glean-core" -version = "53.0.0" +version = "53.1.0" dependencies = [ "android_logger", "bincode", diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index ab6008152e..df778ee8fc 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -1687,8 +1687,18 @@ The following text applies to code linked from these dependencies: The following text applies to code linked from these dependencies: -* [inherent 1.0.5]( https://github.com/dtolnay/inherent ) +* [anyhow 1.0.71]( https://github.com/dtolnay/anyhow ) +* [basic-toml 0.1.2]( https://github.com/dtolnay/basic-toml ) +* [inherent 1.0.7]( https://github.com/dtolnay/inherent ) * [libc 0.2.139]( https://github.com/rust-lang/libc ) +* [proc-macro2 1.0.59]( https://github.com/dtolnay/proc-macro2 ) +* [quote 1.0.28]( https://github.com/dtolnay/quote ) +* [serde 1.0.163]( https://github.com/serde-rs/serde ) +* [serde_derive 1.0.163]( https://github.com/serde-rs/serde ) +* [syn 2.0.18]( https://github.com/dtolnay/syn ) +* [thiserror 1.0.40]( https://github.com/dtolnay/thiserror ) +* [thiserror-impl 1.0.40]( https://github.com/dtolnay/thiserror ) +* [unicode-ident 1.0.9]( https://github.com/dtolnay/unicode-ident ) ``` Apache License @@ -1874,8 +1884,8 @@ END OF TERMS AND CONDITIONS The following text applies to code linked from these dependencies: -* [askama 0.11.1]( https://github.com/djc/askama ) -* [askama_derive 0.11.2]( https://github.com/djc/askama ) +* [askama 0.12.0]( https://github.com/djc/askama ) +* [askama_derive 0.12.1]( https://github.com/djc/askama ) * [askama_escape 0.10.3]( https://github.com/djc/askama ) ``` @@ -2087,7 +2097,6 @@ limitations under the License. The following text applies to code linked from these dependencies: -* [anyhow 1.0.68]( https://github.com/dtolnay/anyhow ) * [bitflags 1.3.2]( https://github.com/bitflags/bitflags ) * [camino 1.1.4]( https://github.com/camino-rs/camino ) * [cfg-if 1.0.0]( https://github.com/alexcrichton/cfg-if ) @@ -2105,30 +2114,23 @@ The following text applies to code linked from these dependencies: * [itoa 1.0.4]( https://github.com/dtolnay/itoa ) * [lazy_static 1.4.0]( https://github.com/rust-lang-nursery/lazy-static.rs ) * [linux-raw-sys 0.1.4]( https://github.com/sunfishcode/linux-raw-sys ) +* [log 0.4.18]( https://github.com/rust-lang/log ) * [mime 0.3.16]( https://github.com/hyperium/mime ) * [num-integer 0.1.45]( https://github.com/rust-num/num-integer ) * [num-traits 0.2.15]( https://github.com/rust-num/num-traits ) * [num_cpus 1.15.0]( https://github.com/seanmonstar/num_cpus ) -* [once_cell 1.17.1]( https://github.com/matklad/once_cell ) +* [once_cell 1.18.0]( https://github.com/matklad/once_cell ) * [paste 1.0.10]( https://github.com/dtolnay/paste ) * [percent-encoding 2.2.0]( https://github.com/servo/rust-url/ ) * [plain 0.2.3]( https://github.com/randomites/plain ) -* [proc-macro2 1.0.47]( https://github.com/dtolnay/proc-macro2 ) -* [quote 1.0.21]( https://github.com/dtolnay/quote ) * [rustix 0.36.7]( https://github.com/bytecodealliance/rustix ) * [semver 1.0.14]( https://github.com/dtolnay/semver ) -* [serde 1.0.150]( https://github.com/serde-rs/serde ) -* [serde_derive 1.0.150]( https://github.com/serde-rs/serde ) * [serde_json 1.0.89]( https://github.com/serde-rs/json ) -* [syn 1.0.105]( https://github.com/dtolnay/syn ) * [tempfile 3.4.0]( https://github.com/Stebalien/tempfile ) -* [thiserror 1.0.37]( https://github.com/dtolnay/thiserror ) -* [thiserror-impl 1.0.37]( https://github.com/dtolnay/thiserror ) * [time 0.1.45]( https://github.com/time-rs/time ) * [toml 0.5.10]( https://github.com/toml-rs/toml ) * [unicase 2.6.0]( https://github.com/seanmonstar/unicase ) * [unicode-bidi 0.3.8]( https://github.com/servo/unicode-bidi ) -* [unicode-ident 1.0.5]( https://github.com/dtolnay/unicode-ident ) * [unicode-normalization 0.1.22]( https://github.com/unicode-rs/unicode-normalization ) * [url 2.3.1]( https://github.com/servo/rust-url ) * [uuid 1.3.0]( https://github.com/uuid-rs/uuid ) @@ -3188,7 +3190,6 @@ limitations under the License. The following text applies to code linked from these dependencies: * [fs-err 2.9.0]( https://github.com/andrewhickman/fs-err ) -* [log 0.4.17]( https://github.com/rust-lang/log ) ``` Apache License @@ -3399,47 +3400,6 @@ limitations under the License. The following text applies to code linked from these dependencies: -* [num_cpus 1.15.0]( https://github.com/seanmonstar/num_cpus ) - -``` -# Contributing - -## License - -Licensed under either of - - * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) - * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) - -at your option. - -### Contribution - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any -additional terms or conditions. - -``` -## Apache License 2.0 - - -The following text applies to code linked from these dependencies: - -* [winapi 0.3.9]( https://github.com/retep998/winapi-rs ) - -``` -// Licensed under the Apache License, Version 2.0 -// or the MIT license -// , at your option. -// All files in the project carrying such notice may not be copied, modified, or distributed -// except according to those terms. - -``` -## Apache License 2.0 - - -The following text applies to code linked from these dependencies: - * [android_log-sys 0.2.0]( https://github.com/nercury/android_log-sys-rs ) ``` @@ -3862,8 +3822,6 @@ limitations under the License. The following text applies to code linked from these dependencies: -* [askama_shared 0.12.2]( https://github.com/djc/askama ) -* [chrono 0.4.19]( https://github.com/chronotope/chrono ) * [lmdb-rkv-sys 0.11.2]( https://github.com/mozilla/lmdb-rs.git ) * [siphasher 0.3.10]( https://github.com/jedisct1/rust-siphash ) * [tinyvec_macros 0.1.0]( https://github.com/Soveu/tinyvec_macros ) @@ -3951,16 +3909,249 @@ limitations under the License. The following text applies to code linked from these dependencies: -* [unicode-normalization 0.1.22]( https://github.com/unicode-rs/unicode-normalization ) +* [chrono 0.4.19]( https://github.com/chronotope/chrono ) ``` -Licensed under the Apache License, Version 2.0 - or the MIT -license , -at your option. All files in the project carrying such -notice may not be copied, modified, or distributed except -according to those terms. +Rust-chrono is dual-licensed under The MIT License [1] and +Apache 2.0 License [2]. Copyright (c) 2014--2017, Kang Seonghoon and +contributors. + +Nota Bene: This is same as the Rust Project's own license. + + +[1]: , which is reproduced below: + +~~~~ +The MIT License (MIT) + +Copyright (c) 2014, Kang Seonghoon. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +~~~~ + + +[2]: , which is reproduced below: + +~~~~ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +~~~~ + ``` ## BSD 2-Clause "Simplified" License @@ -4130,7 +4321,7 @@ DEALINGS IN THE SOFTWARE. The following text applies to code linked from these dependencies: -* [scroll_derive 0.11.0]( https://github.com/m4b/scroll ) +* [scroll_derive 0.11.1]( https://github.com/m4b/scroll ) ``` MIT License @@ -4521,31 +4712,15 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -``` -## MIT License - - -The following text applies to code linked from these dependencies: - -* [byteorder 1.4.3]( https://github.com/BurntSushi/byteorder ) -* [memchr 2.5.0]( https://github.com/BurntSushi/memchr ) -* [termcolor 1.2.0]( https://github.com/BurntSushi/termcolor ) -* [winapi-util 0.1.5]( https://github.com/BurntSushi/winapi-util ) - -``` -This project is dual-licensed under the Unlicense and MIT licenses. - -You may use this code under the terms of either license. - ``` ## Mozilla Public License 2.0 The following text applies to code linked from these dependencies: -* [glean 53.0.0]( https://github.com/mozilla/glean ) +* [glean 53.1.0]( https://github.com/mozilla/glean ) * [glean-build 7.1.0]( https://github.com/mozilla/glean ) -* [glean-core 53.0.0]( https://github.com/mozilla/glean ) +* [glean-core 53.1.0]( https://github.com/mozilla/glean ) * [zeitstempel 0.1.1]( https://github.com/badboy/zeitstempel ) ``` @@ -4932,14 +5107,14 @@ The following text applies to code linked from these dependencies: * [embedded-uniffi-bindgen 0.1.0]( https://crates.io/crates/embedded-uniffi-bindgen ) * [glean-bundle 1.0.0]( https://github.com/mozilla/glean ) * [glean-bundle-android 1.0.0]( https://github.com/mozilla/glean ) -* [uniffi 0.23.0]( https://github.com/mozilla/uniffi-rs ) -* [uniffi_bindgen 0.23.0]( https://github.com/mozilla/uniffi-rs ) -* [uniffi_build 0.23.0]( https://github.com/mozilla/uniffi-rs ) -* [uniffi_checksum_derive 0.23.0]( https://github.com/mozilla/uniffi-rs ) -* [uniffi_core 0.23.0]( https://github.com/mozilla/uniffi-rs ) -* [uniffi_macros 0.23.0]( https://github.com/mozilla/uniffi-rs ) -* [uniffi_meta 0.23.0]( https://github.com/mozilla/uniffi-rs ) -* [uniffi_testing 0.23.0]( https://github.com/mozilla/uniffi-rs ) +* [uniffi 0.24.1]( https://github.com/mozilla/uniffi-rs ) +* [uniffi_bindgen 0.24.1]( https://github.com/mozilla/uniffi-rs ) +* [uniffi_build 0.24.1]( https://github.com/mozilla/uniffi-rs ) +* [uniffi_checksum_derive 0.24.1]( https://github.com/mozilla/uniffi-rs ) +* [uniffi_core 0.24.1]( https://github.com/mozilla/uniffi-rs ) +* [uniffi_macros 0.24.1]( https://github.com/mozilla/uniffi-rs ) +* [uniffi_meta 0.24.1]( https://github.com/mozilla/uniffi-rs ) +* [uniffi_testing 0.24.1]( https://github.com/mozilla/uniffi-rs ) ``` Mozilla Public License Version 2.0 @@ -5322,31 +5497,55 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice The following text applies to code linked from these dependencies: -* [unicode-ident 1.0.5]( https://github.com/dtolnay/unicode-ident ) +* [unicode-ident 1.0.9]( https://github.com/dtolnay/unicode-ident ) ``` UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE -Unicode Data Files include all data files under the directories http://www.unicode.org/Public/, http://www.unicode.org/reports/, http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and http://www.unicode.org/utility/trac/browser/. - -Unicode Data Files do not include PDF online code charts under the directory http://www.unicode.org/Public/. - -Software includes any source code published in the Unicode Standard or under the directories http://www.unicode.org/Public/, http://www.unicode.org/reports/, http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and http://www.unicode.org/utility/trac/browser/. +See Terms of Use +for definitions of Unicode Inc.’s Data Files and Software. -NOTICE TO USER: Carefully read the following legal agreement. BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE. +NOTICE TO USER: Carefully read the following legal agreement. +BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S +DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), +YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. +IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE +THE DATA FILES OR SOFTWARE. COPYRIGHT AND PERMISSION NOTICE -Copyright © 1991-2016 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in http://www.unicode.org/copyright.html. +Copyright © 1991-2022 Unicode, Inc. All rights reserved. +Distributed under the Terms of Use in https://www.unicode.org/copyright.html. -Permission is hereby granted, free of charge, to any person obtaining a copy of the Unicode data files and any associated documentation (the "Data Files") or Unicode software and any associated documentation (the "Software") to deal in the Data Files or Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Data Files or Software, and to permit persons to whom the Data Files or Software are furnished to do so, provided that either - - (a) this copyright and permission notice appear with all copies of the Data Files or Software, or - (b) this copyright and permission notice appear in associated Documentation. - -THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR SOFTWARE. - -Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in these Data Files or Software without prior written authorization of the copyright holder. +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Unicode data files and any associated documentation +(the "Data Files") or Unicode software and any associated documentation +(the "Software") to deal in the Data Files or Software +without restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, and/or sell copies of +the Data Files or Software, and to permit persons to whom the Data Files +or Software are furnished to do so, provided that either +(a) this copyright and permission notice appear with all copies +of the Data Files or Software, or +(b) this copyright and permission notice appear in associated +Documentation. + +THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT OF THIRD PARTY RIGHTS. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS +NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL +DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THE DATA FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, +use or other dealings in these Data Files or Software without prior +written authorization of the copyright holder. ``` diff --git a/about.toml b/about.toml index 90c1c261b8..714ca462f0 100644 --- a/about.toml +++ b/about.toml @@ -30,3 +30,4 @@ targets = [ ignore-build-dependencies = true ignore-dev-dependencies = true +no-clearly-defined = true diff --git a/glean-core/Cargo.toml b/glean-core/Cargo.toml index 263539f7fe..155374a6b7 100644 --- a/glean-core/Cargo.toml +++ b/glean-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "glean-core" -version = "53.0.0" +version = "53.1.0" authors = ["Jan-Erik Rediger ", "The Glean Team "] description = "A modern Telemetry library" repository = "https://github.com/mozilla/glean" diff --git a/glean-core/android-native/dependency-licenses.xml b/glean-core/android-native/dependency-licenses.xml index b6e06c459d..3f5ee0804b 100644 --- a/glean-core/android-native/dependency-licenses.xml +++ b/glean-core/android-native/dependency-licenses.xml @@ -36,12 +36,42 @@ the details of which are reproduced below. Apache License 2.0: humantime https://github.com/tailhook/humantime + + Apache License 2.0: anyhow + https://github.com/dtolnay/anyhow + + Apache License 2.0: basic-toml + https://github.com/dtolnay/basic-toml Apache License 2.0: inherent https://github.com/dtolnay/inherent Apache License 2.0: libc https://github.com/rust-lang/libc + + Apache License 2.0: proc-macro2 + https://github.com/dtolnay/proc-macro2 + + Apache License 2.0: quote + https://github.com/dtolnay/quote + + Apache License 2.0: serde + https://github.com/serde-rs/serde + + Apache License 2.0: serde_derive + https://github.com/serde-rs/serde + + Apache License 2.0: syn + https://github.com/dtolnay/syn + + Apache License 2.0: thiserror + https://github.com/dtolnay/thiserror + + Apache License 2.0: thiserror-impl + https://github.com/dtolnay/thiserror + + Apache License 2.0: unicode-ident + https://github.com/dtolnay/unicode-ident Apache License 2.0: askama https://github.com/djc/askama @@ -51,9 +81,6 @@ the details of which are reproduced below. Apache License 2.0: askama_escape https://github.com/djc/askama - - Apache License 2.0: anyhow - https://github.com/dtolnay/anyhow Apache License 2.0: bitflags https://github.com/bitflags/bitflags @@ -105,6 +132,9 @@ the details of which are reproduced below. Apache License 2.0: linux-raw-sys https://github.com/sunfishcode/linux-raw-sys + + Apache License 2.0: log + https://github.com/rust-lang/log Apache License 2.0: mime https://github.com/hyperium/mime @@ -129,39 +159,18 @@ the details of which are reproduced below. Apache License 2.0: plain https://github.com/randomites/plain - - Apache License 2.0: proc-macro2 - https://github.com/dtolnay/proc-macro2 - - Apache License 2.0: quote - https://github.com/dtolnay/quote Apache License 2.0: rustix https://github.com/bytecodealliance/rustix Apache License 2.0: semver https://github.com/dtolnay/semver - - Apache License 2.0: serde - https://github.com/serde-rs/serde - - Apache License 2.0: serde_derive - https://github.com/serde-rs/serde Apache License 2.0: serde_json https://github.com/serde-rs/json - - Apache License 2.0: syn - https://github.com/dtolnay/syn Apache License 2.0: tempfile https://github.com/Stebalien/tempfile - - Apache License 2.0: thiserror - https://github.com/dtolnay/thiserror - - Apache License 2.0: thiserror-impl - https://github.com/dtolnay/thiserror Apache License 2.0: time https://github.com/time-rs/time @@ -174,9 +183,6 @@ the details of which are reproduced below. Apache License 2.0: unicode-bidi https://github.com/servo/unicode-bidi - - Apache License 2.0: unicode-ident - https://github.com/dtolnay/unicode-ident Apache License 2.0: unicode-normalization https://github.com/unicode-rs/unicode-normalization @@ -204,27 +210,12 @@ the details of which are reproduced below. Apache License 2.0: fs-err https://github.com/andrewhickman/fs-err - - Apache License 2.0: log - https://github.com/rust-lang/log - - Apache License 2.0: num_cpus - https://github.com/seanmonstar/num_cpus - - Apache License 2.0: winapi - https://github.com/retep998/winapi-rs Apache License 2.0: android_log-sys https://github.com/nercury/android_log-sys-rs Apache License 2.0: android_logger https://github.com/Nercury/android_logger-rs - - Apache License 2.0: askama_shared - https://github.com/djc/askama - - Apache License 2.0: chrono - https://github.com/chronotope/chrono Apache License 2.0: lmdb-rkv-sys https://github.com/mozilla/lmdb-rs.git @@ -241,8 +232,8 @@ the details of which are reproduced below. Apache License 2.0: xshell-macros https://github.com/matklad/xshell - Apache License 2.0: unicode-normalization - https://github.com/unicode-rs/unicode-normalization + Apache License 2.0: chrono + https://github.com/chronotope/chrono BSD 2-Clause "Simplified" License: arrayref https://github.com/droundy/arrayref @@ -306,18 +297,6 @@ the details of which are reproduced below. MIT License: bincode https://github.com/servo/bincode - - MIT License: byteorder - https://github.com/BurntSushi/byteorder - - MIT License: memchr - https://github.com/BurntSushi/memchr - - MIT License: termcolor - https://github.com/BurntSushi/termcolor - - MIT License: winapi-util - https://github.com/BurntSushi/winapi-util Mozilla Public License 2.0: glean https://github.com/mozilla/glean diff --git a/glean-core/android/dependency-licenses.xml b/glean-core/android/dependency-licenses.xml index b6e06c459d..3f5ee0804b 100644 --- a/glean-core/android/dependency-licenses.xml +++ b/glean-core/android/dependency-licenses.xml @@ -36,12 +36,42 @@ the details of which are reproduced below. Apache License 2.0: humantime https://github.com/tailhook/humantime + + Apache License 2.0: anyhow + https://github.com/dtolnay/anyhow + + Apache License 2.0: basic-toml + https://github.com/dtolnay/basic-toml Apache License 2.0: inherent https://github.com/dtolnay/inherent Apache License 2.0: libc https://github.com/rust-lang/libc + + Apache License 2.0: proc-macro2 + https://github.com/dtolnay/proc-macro2 + + Apache License 2.0: quote + https://github.com/dtolnay/quote + + Apache License 2.0: serde + https://github.com/serde-rs/serde + + Apache License 2.0: serde_derive + https://github.com/serde-rs/serde + + Apache License 2.0: syn + https://github.com/dtolnay/syn + + Apache License 2.0: thiserror + https://github.com/dtolnay/thiserror + + Apache License 2.0: thiserror-impl + https://github.com/dtolnay/thiserror + + Apache License 2.0: unicode-ident + https://github.com/dtolnay/unicode-ident Apache License 2.0: askama https://github.com/djc/askama @@ -51,9 +81,6 @@ the details of which are reproduced below. Apache License 2.0: askama_escape https://github.com/djc/askama - - Apache License 2.0: anyhow - https://github.com/dtolnay/anyhow Apache License 2.0: bitflags https://github.com/bitflags/bitflags @@ -105,6 +132,9 @@ the details of which are reproduced below. Apache License 2.0: linux-raw-sys https://github.com/sunfishcode/linux-raw-sys + + Apache License 2.0: log + https://github.com/rust-lang/log Apache License 2.0: mime https://github.com/hyperium/mime @@ -129,39 +159,18 @@ the details of which are reproduced below. Apache License 2.0: plain https://github.com/randomites/plain - - Apache License 2.0: proc-macro2 - https://github.com/dtolnay/proc-macro2 - - Apache License 2.0: quote - https://github.com/dtolnay/quote Apache License 2.0: rustix https://github.com/bytecodealliance/rustix Apache License 2.0: semver https://github.com/dtolnay/semver - - Apache License 2.0: serde - https://github.com/serde-rs/serde - - Apache License 2.0: serde_derive - https://github.com/serde-rs/serde Apache License 2.0: serde_json https://github.com/serde-rs/json - - Apache License 2.0: syn - https://github.com/dtolnay/syn Apache License 2.0: tempfile https://github.com/Stebalien/tempfile - - Apache License 2.0: thiserror - https://github.com/dtolnay/thiserror - - Apache License 2.0: thiserror-impl - https://github.com/dtolnay/thiserror Apache License 2.0: time https://github.com/time-rs/time @@ -174,9 +183,6 @@ the details of which are reproduced below. Apache License 2.0: unicode-bidi https://github.com/servo/unicode-bidi - - Apache License 2.0: unicode-ident - https://github.com/dtolnay/unicode-ident Apache License 2.0: unicode-normalization https://github.com/unicode-rs/unicode-normalization @@ -204,27 +210,12 @@ the details of which are reproduced below. Apache License 2.0: fs-err https://github.com/andrewhickman/fs-err - - Apache License 2.0: log - https://github.com/rust-lang/log - - Apache License 2.0: num_cpus - https://github.com/seanmonstar/num_cpus - - Apache License 2.0: winapi - https://github.com/retep998/winapi-rs Apache License 2.0: android_log-sys https://github.com/nercury/android_log-sys-rs Apache License 2.0: android_logger https://github.com/Nercury/android_logger-rs - - Apache License 2.0: askama_shared - https://github.com/djc/askama - - Apache License 2.0: chrono - https://github.com/chronotope/chrono Apache License 2.0: lmdb-rkv-sys https://github.com/mozilla/lmdb-rs.git @@ -241,8 +232,8 @@ the details of which are reproduced below. Apache License 2.0: xshell-macros https://github.com/matklad/xshell - Apache License 2.0: unicode-normalization - https://github.com/unicode-rs/unicode-normalization + Apache License 2.0: chrono + https://github.com/chronotope/chrono BSD 2-Clause "Simplified" License: arrayref https://github.com/droundy/arrayref @@ -306,18 +297,6 @@ the details of which are reproduced below. MIT License: bincode https://github.com/servo/bincode - - MIT License: byteorder - https://github.com/BurntSushi/byteorder - - MIT License: memchr - https://github.com/BurntSushi/memchr - - MIT License: termcolor - https://github.com/BurntSushi/termcolor - - MIT License: winapi-util - https://github.com/BurntSushi/winapi-util Mozilla Public License 2.0: glean https://github.com/mozilla/glean diff --git a/glean-core/python/setup.py b/glean-core/python/setup.py index 11550fd883..f635f9c72d 100644 --- a/glean-core/python/setup.py +++ b/glean-core/python/setup.py @@ -56,7 +56,7 @@ history = history_file.read() # glean version. Automatically updated by the bin/prepare_release.sh script -version = "53.0.0" +version = "53.1.0" requirements = [ "semver>=2.13.0", diff --git a/glean-core/rlb/Cargo.toml b/glean-core/rlb/Cargo.toml index 6668673db9..13335b293b 100644 --- a/glean-core/rlb/Cargo.toml +++ b/glean-core/rlb/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "glean" -version = "53.0.0" +version = "53.1.0" authors = ["Jan-Erik Rediger ", "The Glean Team "] description = "Glean SDK Rust language bindings" repository = "https://github.com/mozilla/glean" @@ -23,7 +23,7 @@ maintenance = { status = "actively-developed" } [dependencies.glean-core] path = ".." -version = "53.0.0" +version = "53.1.0" [dependencies] crossbeam-channel = "0.5" diff --git a/gradle-plugin/src/main/groovy/mozilla/telemetry/glean-gradle-plugin/GleanGradlePlugin.groovy b/gradle-plugin/src/main/groovy/mozilla/telemetry/glean-gradle-plugin/GleanGradlePlugin.groovy index dc5529e995..58b919d93b 100644 --- a/gradle-plugin/src/main/groovy/mozilla/telemetry/glean-gradle-plugin/GleanGradlePlugin.groovy +++ b/gradle-plugin/src/main/groovy/mozilla/telemetry/glean-gradle-plugin/GleanGradlePlugin.groovy @@ -555,7 +555,7 @@ except: void apply(Project project) { isOffline = project.gradle.startParameter.offline - project.ext.glean_version = "53.0.0" + project.ext.glean_version = "53.1.0" def parserVersion = gleanParserVersion(project) // Print the required glean_parser version to the console. This is From c4e95dbccc96f21d43b72463e4c4eb718e601205 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Thu, 29 Jun 2023 23:47:05 -0400 Subject: [PATCH 74/74] Update ktlint to version 0.50.0 and fix new warnings --- build.gradle | 2 +- .../android/src/main/java/mozilla/telemetry/glean/Glean.kt | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 010ec5dbce..4b5d089795 100644 --- a/build.gradle +++ b/build.gradle @@ -200,7 +200,7 @@ configurations { } dependencies { - ktlint("com.pinterest:ktlint:0.49.1") { + ktlint("com.pinterest:ktlint:0.50.0") { attributes { attribute(Bundling.BUNDLING_ATTRIBUTE, getObjects().named(Bundling, Bundling.EXTERNAL)) } diff --git a/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt b/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt index 26dc512d67..94c72bf0e0 100644 --- a/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt +++ b/glean-core/android/src/main/java/mozilla/telemetry/glean/Glean.kt @@ -2,6 +2,8 @@ * 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/. */ +@file:Suppress("ktlint:standard:no-wildcard-imports") + package mozilla.telemetry.glean import android.app.ActivityManager @@ -16,7 +18,7 @@ import kotlinx.coroutines.MainScope import kotlinx.coroutines.launch import mozilla.telemetry.glean.GleanMetrics.GleanValidation import mozilla.telemetry.glean.config.Configuration -import mozilla.telemetry.glean.internal.* // ktlint-disable no-wildcard-imports +import mozilla.telemetry.glean.internal.* import mozilla.telemetry.glean.net.BaseUploader import mozilla.telemetry.glean.scheduler.GleanLifecycleObserver import mozilla.telemetry.glean.scheduler.MetricsPingScheduler