diff --git a/Cargo.lock b/Cargo.lock index a6489d29e07c..58a3072f01ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2643,9 +2643,9 @@ dependencies = [ [[package]] name = "glean" -version = "64.0.1" +version = "64.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "251b9cb685554b96dcf785dba69ce90447006dd6d9229db783336c981c3777e1" +checksum = "95024f4707705270208e36983976cbac235dd7fc33c9f1cb0dee396ec1ce295d" dependencies = [ "crossbeam-channel", "glean-core", @@ -2657,9 +2657,9 @@ dependencies = [ [[package]] name = "glean-core" -version = "64.0.1" +version = "64.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49d1d62648ddeed8cb996373046ea45de93f1d1ff956aba054b9304bc305753" +checksum = "5ca0df94fb37669287b77e8aa300913ad1d14426d7f9e443b0ce1185349c817e" dependencies = [ "android_logger", "bincode", diff --git a/Cargo.toml b/Cargo.toml index a10ecb2377c6..45126d563dad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,7 +68,7 @@ uniffi_bindgen = "0.29.1" # Shared across multiple application-services consumers. rusqlite = "0.33.0" # Shared across multiple glean consumers. -glean = "=64.0.1" +glean = "=64.1.1" # Explicitly specify what our profiles use. The opt-level setting here is # a total fiction; see the setup of MOZ_RUST_DEFAULT_FLAGS for what the diff --git a/gfx/wr/Cargo.lock b/gfx/wr/Cargo.lock index 5a6906fe77c7..811c44d0ad1b 100644 --- a/gfx/wr/Cargo.lock +++ b/gfx/wr/Cargo.lock @@ -982,9 +982,9 @@ dependencies = [ [[package]] name = "glean" -version = "64.0.1" +version = "64.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "251b9cb685554b96dcf785dba69ce90447006dd6d9229db783336c981c3777e1" +checksum = "95024f4707705270208e36983976cbac235dd7fc33c9f1cb0dee396ec1ce295d" dependencies = [ "crossbeam-channel", "glean-core", @@ -996,9 +996,9 @@ dependencies = [ [[package]] name = "glean-core" -version = "64.0.1" +version = "64.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49d1d62648ddeed8cb996373046ea45de93f1d1ff956aba054b9304bc305753" +checksum = "5ca0df94fb37669287b77e8aa300913ad1d14426d7f9e443b0ce1185349c817e" dependencies = [ "android_logger", "bincode", diff --git a/gfx/wr/Cargo.toml b/gfx/wr/Cargo.toml index f3a710877f2c..dbb574a052bd 100644 --- a/gfx/wr/Cargo.toml +++ b/gfx/wr/Cargo.toml @@ -9,7 +9,7 @@ members = [ resolver = "2" [workspace.dependencies] -glean = "=64.0.1" +glean = "=64.1.1" [profile.release] debug = true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index db636e3445c2..ff7258ba963e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -81,7 +81,7 @@ serialization = "1.8.1" # Mozilla versions apilint = "0.5.4" -mozilla-glean = "64.0.1" +mozilla-glean = "64.1.1" # Testing versions androidx-test = "1.6.1" diff --git a/python/sites/mach.txt b/python/sites/mach.txt index 1c855856d1b3..3c2027df965c 100644 --- a/python/sites/mach.txt +++ b/python/sites/mach.txt @@ -104,7 +104,7 @@ vendored:third_party/python/wheel vendored:third_party/python/zipp # glean-sdk may not be installable if a wheel isn't available # and it has to be built from source. -pypi-optional:glean-sdk==64.0.1:telemetry will not be collected +pypi-optional:glean-sdk==64.1.1:telemetry will not be collected # Mach gracefully handles the case where `psutil` is unavailable. # We aren't (yet) able to pin packages in automation, so we have to # support down to the oldest locally-installed version (5.4.2). diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml index b49cc9680da8..fe35784924b1 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml @@ -3707,16 +3707,6 @@ who = "Erich Gubler " criteria = "safe-to-deploy" delta = "23.1.0 -> 24.0.0" -[[audits.naga]] -who = [ - "Teodor Tanasoaia ", - "Erich Gubler ", - "Jim Blandy ", -] -criteria = "safe-to-deploy" -delta = "24.0.0 -> 24.0.0@git:a0dbe5ebc6fa24422fb84b2e0fea1cc94dee5109" -importable = false - [[audits.naga]] who = "Erich Gubler " criteria = "safe-to-deploy" @@ -5998,16 +5988,6 @@ who = "Erich Gubler " criteria = "safe-to-deploy" delta = "23.0.1 -> 24.0.0" -[[audits.wgpu-core]] -who = [ - "Teodor Tanasoaia ", - "Erich Gubler ", - "Jim Blandy ", -] -criteria = "safe-to-deploy" -delta = "24.0.0 -> 24.0.0@git:a0dbe5ebc6fa24422fb84b2e0fea1cc94dee5109" -importable = false - [[audits.wgpu-core]] who = "Erich Gubler " criteria = "safe-to-deploy" @@ -6119,16 +6099,6 @@ who = "Erich Gubler " criteria = "safe-to-deploy" delta = "23.0.1 -> 24.0.0" -[[audits.wgpu-hal]] -who = [ - "Teodor Tanasoaia ", - "Erich Gubler ", - "Jim Blandy ", -] -criteria = "safe-to-deploy" -delta = "24.0.0 -> 24.0.0@git:a0dbe5ebc6fa24422fb84b2e0fea1cc94dee5109" -importable = false - [[audits.wgpu-hal]] who = "Erich Gubler " criteria = "safe-to-deploy" @@ -6213,16 +6183,6 @@ who = "Erich Gubler " criteria = "safe-to-deploy" delta = "23.0.0 -> 24.0.0" -[[audits.wgpu-types]] -who = [ - "Teodor Tanasoaia ", - "Erich Gubler ", - "Jim Blandy ", -] -criteria = "safe-to-deploy" -delta = "24.0.0 -> 24.0.0@git:a0dbe5ebc6fa24422fb84b2e0fea1cc94dee5109" -importable = false - [[audits.wgpu-types]] who = "Erich Gubler " criteria = "safe-to-deploy" diff --git a/supply-chain/config.toml b/supply-chain/config.toml index 7a358353316b..cb611b3e22c4 100644 --- a/supply-chain/config.toml +++ b/supply-chain/config.toml @@ -289,10 +289,6 @@ notes = "Local override of the crates.io crate that uses a non-vendored local co [policy.wr_malloc_size_of] audit-as-crates-io = false -[[exemptions.ahash]] -version = "0.7.6" -criteria = "safe-to-deploy" - [[exemptions.alsa]] version = "0.4.3" criteria = "safe-to-deploy" diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock index d8fe9a900680..54bf46974cc7 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -258,15 +258,15 @@ user-login = "jrmuizel" user-name = "Jeff Muizelaar" [[publisher.glean]] -version = "64.0.1" -when = "2025-04-01" +version = "64.1.1" +when = "2025-04-10" user-id = 48 user-login = "badboy" user-name = "Jan-Erik Rediger" [[publisher.glean-core]] -version = "64.0.1" -when = "2025-04-01" +version = "64.1.1" +when = "2025-04-10" user-id = 48 user-login = "badboy" user-name = "Jan-Erik Rediger" @@ -970,20 +970,6 @@ criteria = "safe-to-deploy" version = "1.0.2" notes = "This is a small crate which forbids unsafe code and is a straightforward implementation of the adler hashing algorithm." -[[audits.bytecode-alliance.audits.ahash]] -who = "Chris Fallin " -criteria = "safe-to-deploy" -delta = "0.7.6 -> 0.8.2" - -[[audits.bytecode-alliance.audits.ahash]] -who = "Alex Crichton " -criteria = "safe-to-deploy" -delta = "0.8.2 -> 0.8.7" -notes = """ -Shuffling of features in this update and while there are updates to `unsafe` -code it's no different than before and the usage remains the same. -""" - [[audits.bytecode-alliance.audits.allocator-api2]] who = "Chris Fallin " criteria = "safe-to-deploy" diff --git a/third_party/rust/glean-core/.cargo-checksum.json b/third_party/rust/glean-core/.cargo-checksum.json index 85a4d137a37d..146abf79a3d3 100644 --- a/third_party/rust/glean-core/.cargo-checksum.json +++ b/third_party/rust/glean-core/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"0359eee0959129d95bc83af3048a2830b7d1f5e87befdf66631da955485a62f8","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"026495898699b54608eb4ec16074ffafc57920d80ccb59961c501a1ea28c9985","build.rs":"4857bea99c6b8c08db8818efa9d3738716f52d3acb68159323957ae52892a3eb","src/common_metric_data.rs":"02dd1628fed6587621c089952dd0cb80bed3c352cdacfb33be7e218ad1d847e9","src/core/mod.rs":"cc723d90c1738bec63b7522793eddfbd4c6d14c792bea49a60cbb361faaa84a1","src/core_metrics.rs":"a877e42e0f8b932adb52a5681ad76fd977808cb48c7eeb29b1e4bbe804f1ea96","src/coverage.rs":"49613fd310bd24d779472720975fbe6c97ec370a95eb55f10afa43f67539c942","src/database/mod.rs":"d9c01ecf92b69a0fe826abf1abf81569ab0dbe61d7f3d8c41201f3a21ac1b13b","src/debug.rs":"7bd9e199d0d5c8170f6dbb9a725a18eaca1df34309d32b02081574962a86816e","src/dispatcher/global.rs":"17493b1a5e926ca1e9c1cda2ee031773402a19183911eb80048630d60266d89e","src/dispatcher/mod.rs":"391310269947452d7e0de24c848c183110c60149d75e345ba6d5d146f222dace","src/error.rs":"b93c7d3e243b21bb9eafc95f17860aba1a942b2f2b0a7f43307690f05fece516","src/error_recording.rs":"32c1f58ff080cb22184bca37e356faadbfe846386880fb0898b773adb3a97d8c","src/event_database/mod.rs":"33519a9f648b6b8a014c23a47c8aa74420511027b9c6984e0c77a4e6192c02c6","src/fd_logger.rs":"0c9def6fa53db1a2ab93c85795f8a7df57797bcfd3978146923e151752e291a6","src/glean.udl":"413784d0c8ef2f0ee34e7535fb10d2f31058dfd558d0121d5ad77d9f00aded96","src/glean_metrics.rs":"9414fb1453d19f6832df33e4c6ef7383d62203e47026bf5bc9552b083101ddd1","src/histogram/exponential.rs":"0f2c0857782d6910754a01438b1b4cd77bf0d3b847fd9ef969ba4da3705c5f5b","src/histogram/functional.rs":"22b2e64c3c1930e055beeebb832e3212e22b65b28e2ebb94c6bb3aff7ca31ba3","src/histogram/linear.rs":"bc33060cbbbb9c777539074cf5f788ab0f1a4ccecce0bf2cae2a697dd5089ea0","src/histogram/mod.rs":"c5eca9f6b0e1e309a7b41c2427d4c1da9c30e832d358d65ba347ba522abfd9c7","src/internal_metrics.rs":"b07018078a09c46ab3416818ddab6bd31a4d5beeeaf677ed6edba10b2b524326","src/internal_pings.rs":"3957a9fe256977a05d8d9e3beeec4c1fd08029db1c516fec4f6b59888e46ef39","src/lib.rs":"b9d89f63cde771d31fea5659ed534478df5f63595254e6a4648ba7c9ad7f8d85","src/lib_unit_tests.rs":"470dca51a00acf316e7afd30d337731724116308553c8596db1890ea8d127388","src/metrics/boolean.rs":"2b9ef57e3582c9bd8b2cca8ab94c962a4871ecc00e837b913c9b0349ba9dff08","src/metrics/counter.rs":"b4a52a8167fb0edd6354f952525e59f3eadb4261de3483374f03c94449d30b92","src/metrics/custom_distribution.rs":"1ec4fd2ecebf547bef0ed28ae6854f641be447bcbf4066a8580f6af16a23e37f","src/metrics/datetime.rs":"e4405762fc71718299fa1b208e3d5fda654bd1b82fe908c884c284e3530de2ec","src/metrics/denominator.rs":"95e8442f90bad97f80fc74b146782f215344b52c5f3825ae0a8baffdc001a714","src/metrics/event.rs":"cd52e200d313e2e6f31707419d4a7fe1cab34916ee145f8136440d6da34aaad4","src/metrics/experiment.rs":"5f9278cca4e133eb8df33bbfe36d1fe0ef3eade8c09f1b46db3c4d0790515412","src/metrics/labeled.rs":"e6afd55c7f7632c962c84de842b302b53df11660ed59b586f85e6e92808a23d8","src/metrics/memory_distribution.rs":"d3f02a6a78ed103024a2479975cd7617153e3f082e20f8f45c8e7afd052cec45","src/metrics/memory_unit.rs":"ee32e020cb303dd631457374048a3ed53a2e7cbacc29c54d17d836fb15507538","src/metrics/mod.rs":"777f89015c1642ed73536b07edc0763d179dbf608e2a0394439fe002cbc2fb53","src/metrics/numerator.rs":"937dfd583b797ac798a525cedca95c5a36262356760a89670d8113983c263154","src/metrics/object.rs":"2a1f1cc31973b576e55ba464b35c41b9420f62471eebba51273bca6856459538","src/metrics/ping.rs":"3b4524e8d17d55fe993746061636fb7d9566b51ac511765e173e7247907f0493","src/metrics/quantity.rs":"1315ae3216ebeec5b5a5baab88d63f88469875f538501e8320716516ef82bddf","src/metrics/rate.rs":"603cc45c149c7a27c93b6a80146bf43f8ce70d9655f905bb5be6bc2c15bcb22b","src/metrics/recorded_experiment.rs":"33958abee79d8b55dec4cb5d20742640423713010f76314075cefde18b5c118a","src/metrics/remote_settings_config.rs":"c85af9f9fef87ddfc578af4f2637c9bdcae18fbc6735ccc87a13a9b0ee0319ab","src/metrics/string.rs":"88beb1a847e5df9898b72ca7ed8ced3b7d2b40d83ff3670baf66f83a3e6cb005","src/metrics/string_list.rs":"ed53a095184c3e8224d0511809b5d7601ba3166505a39b0570f24ebeb0a5b97c","src/metrics/text.rs":"757f6919124d74e0512faa5bb9751a729b6bbc63ebe4d16ca81e9087f5595eaf","src/metrics/time_unit.rs":"4704703e19e799933aec3f39e3d3a125058756d7c7ba04f8729885c7843df447","src/metrics/timespan.rs":"e239c618f459c34f2799c73a4da3e3c6c0b2089ba42d584c2ddd12ed067586e6","src/metrics/timing_distribution.rs":"c61a2cd32a54e018b4b0bb60f030bada40fcbe68d6e6346eac8212cf416e14a3","src/metrics/url.rs":"589ae1f8047367ad8c19b57a48ca8130d5f36cf3ce5954124150f0eb89c620ea","src/metrics/uuid.rs":"cacffd95ab30ed327ec2fa5feaf1359e667706746401f1e2c1195ad9553c4b54","src/ping/mod.rs":"70c6f4966d760e95d450d60bc9e720dec4576febfc487de3634fefacd9f2d8e7","src/scheduler.rs":"eb8131ed075e2d92bf0dc0a2c2a7e67c73bb61042d574c21965b1699cd1239aa","src/storage/mod.rs":"91f02556f113799e0d88d732ab342bda443f43461369e8b41c424c074d742591","src/system.rs":"e3d1b54e1d39cafe6f4dc7ff5021b08c879733f909951b0e1332b3efa9ed97bd","src/traits/boolean.rs":"be0e130f8043215705becc956d45b126c340568f1b24a396c0af9b4334a41ced","src/traits/counter.rs":"c686d26e131d854cd7a7df83c900ca7c17a03c663a30cf58ab48c7259476ce85","src/traits/custom_distribution.rs":"0bd1d425e4c059cca6af2dfb13c78e5e4c6c07fb46c7e31489ad0c5959854833","src/traits/datetime.rs":"636ac1456b1b042e38cf5ae6193c5b232ea0b80df62f583a2097891baef9641b","src/traits/event.rs":"a02235aae630aba7a45a3166b756927252b397af3ecdfab7236931e62725ac49","src/traits/labeled.rs":"c633c68e70a44e73f8aff88aaab1029c0faded3cad08d822590ed8838f24b4fd","src/traits/memory_distribution.rs":"55bb8f45e948319fbba9d28a50d8742da134b066a42e480887db7c7e435f4096","src/traits/mod.rs":"3560fdf3b81dceabbac9d97b0356aa8f883e477dcb787c81a09529047fda7161","src/traits/numerator.rs":"6e4f236bdc448f1bde7a8c249dcd086204c2c69990d3f444e746290929226ed3","src/traits/object.rs":"c03bad670ec7affbc578247f9e1904e898c1870b9bf25750c5094113f995623f","src/traits/ping.rs":"8831c106c03afeb458b0b028fa1ce61f056ebf8e82bc0a171a1bff255d920748","src/traits/quantity.rs":"6ffe25c913bef4315573d747308c182de740b2a4e02ba22cd21d0c33ba521f31","src/traits/rate.rs":"f000790440e0f389f0b160526a9a9a266e58d1405915ae56ac550f482858222c","src/traits/string.rs":"0c3c88382ff2e8eba89c7cfe129c4b84e31140af717819533c14919541ad790c","src/traits/string_list.rs":"14e56b62c2c2be1dd8013f12001f235b084abd2a0d5aa2f7932843877af49ac0","src/traits/text.rs":"8af7d3a0c87cfd8c6d33d6ad47532b431055bbdd395f9110da5630222c23cf93","src/traits/timespan.rs":"52be325a9c061916f34c5b638a07a93b4a14aa89fe365783103d2e06b998f547","src/traits/timing_distribution.rs":"0d35acddd9e35a7f8859cf007162460b5fd0bf06d205cd195ed1c857bbe58c42","src/traits/url.rs":"c27f7add23214ff051078b65b88120b620560d2841a1056c7214d5237e86b9e4","src/traits/uuid.rs":"81322e71c7e847bacaf827a2cd58f6193bdc208355524207f7f38db039da6aa8","src/upload/directory.rs":"363ddc345845c2d543f833a5a63f1c778455e68b36ac77ffce605cef29f0d5cb","src/upload/mod.rs":"edae31e4c2172fb1e8e8b2c5542812b1e29c3bfa2f1c7b08227cb7cc4260dd48","src/upload/policy.rs":"c250957a37783e74af8002cd80ba06ef9780a389fb0f61b8b665b79688f0a360","src/upload/request.rs":"de5532fc3d18e773330c05fe000643d87b9c4912a2d838099b8783538c5033ed","src/upload/result.rs":"c956266c54595d27d5e8b11abffe28fad5fea82995922618805b66cfdcc21d54","src/util.rs":"ee7500434d9758a320dd410f18d7e18da956591e19d2555db87eef9623e4b916","tests/boolean.rs":"76d6014ff108cb6514d9bceb1b2b14749a55b09921f4595a5e30f1bd3546e9f0","tests/collection_enabled.rs":"85f4b2eb49ac23437ae225ae2c44f354c952c24b7c806e2f2ee5dbe78e02c8db","tests/common/mod.rs":"a8f74c906dccfe747d5cf9dd83dd6e4d1ef25d0402d39a2d74105cddab80e54c","tests/counter.rs":"4c59def10e64de0d7a0241dde0267fd02c828b38be8cc67fba90a76004ca6721","tests/custom_distribution.rs":"41c593a0b4561e21f29d1a5b948de964a866253c58ca76ffefebe370fca150e0","tests/datetime.rs":"ec3c9760e70bb2cbc61ab23281c891bc1ec493c5c545466c29fd13e4f05c2c96","tests/event.rs":"5db675dad1bcbcee0451bfe5e93f05f28d7ef8098d19cd302c8bac262567cf0c","tests/labeled.rs":"6f2c6489bcb297b2b64740712b4902e4997fb5c0ba9cb3552a5f6c1fddd45d2f","tests/memory_distribution.rs":"3d9a5b8f99e03f783e3396e4320ee4dc974c895cfef2cec0b14d2a9a9f9b736f","tests/object.rs":"8c35676e04f6ccf54a28764700915e753fc0355bfa5d7804d72caba66fd564cd","tests/ping.rs":"eff68d3b47b04c58d8123214dd66e8d06d11f82ed3fd4f703224f84effb319bb","tests/ping_maker.rs":"20954903888798f63ca83a03ba4703f60ee7ba40dce13f225e8d8e73425d3605","tests/quantity.rs":"55e7dca346fd1d27f0974b78ca3fb12427cb5da2ee637afc08a54f360f947361","tests/rate.rs":"94a3a7d0ccafea02a991ed9dd038cbfab8a534695b374b1ce6ed81285616e9f6","tests/storage.rs":"990dd1d13b9ffa8af0686977a6ac3502c6befb9eaa83649587e2660f51c596c9","tests/string.rs":"397fcfd27c25f0e81e2a40db3265b0d7dc0dd56b190319c1f86cb1c2c0ed4f9d","tests/string_list.rs":"34efa2afe3e89e6635f21ec9c80650d5816e35e9cb85163d894d600a5b3a4e3a","tests/text.rs":"1d43f6b90a43124311cacf0a6ee16f9e1e9263bcd11fee8b996d6efd81633638","tests/timespan.rs":"3d05739a93f3e0ea7264e8fdea876bd948714e5b44e82b8fd7c0218fdb597bb3","tests/timing_distribution.rs":"072ad950b2162e503150e411119b9a000573538bd2cff93c1c1a3616d1589ef4","tests/uuid.rs":"e0e58614319f5e973126f5b4e68d9289ccd6d65e428aca215bf7dcc8a0504889","uniffi.toml":"6ddc98b686b0925a81abd9d1c769e5c98ac29771b210a1c535931a46dec9a8e3"},"package":"a49d1d62648ddeed8cb996373046ea45de93f1d1ff956aba054b9304bc305753"} \ No newline at end of file +{"files":{"Cargo.toml":"ffc8000a6fb68eb9465dff661e40e43b95fef93cf874a03bc8c4bc9642c6e766","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"026495898699b54608eb4ec16074ffafc57920d80ccb59961c501a1ea28c9985","build.rs":"4857bea99c6b8c08db8818efa9d3738716f52d3acb68159323957ae52892a3eb","src/common_metric_data.rs":"02dd1628fed6587621c089952dd0cb80bed3c352cdacfb33be7e218ad1d847e9","src/core/mod.rs":"e749d51f05fcfc9651e4021cd90682dafc107e58db0083e1b48f8df277d4581c","src/core_metrics.rs":"fb9707a4df04113d84e7608a15a7a4fd6a826a97b9aad73ec3438a8cad92b4b0","src/coverage.rs":"49613fd310bd24d779472720975fbe6c97ec370a95eb55f10afa43f67539c942","src/database/mod.rs":"d9c01ecf92b69a0fe826abf1abf81569ab0dbe61d7f3d8c41201f3a21ac1b13b","src/debug.rs":"7bd9e199d0d5c8170f6dbb9a725a18eaca1df34309d32b02081574962a86816e","src/dispatcher/global.rs":"17493b1a5e926ca1e9c1cda2ee031773402a19183911eb80048630d60266d89e","src/dispatcher/mod.rs":"391310269947452d7e0de24c848c183110c60149d75e345ba6d5d146f222dace","src/error.rs":"b93c7d3e243b21bb9eafc95f17860aba1a942b2f2b0a7f43307690f05fece516","src/error_recording.rs":"32c1f58ff080cb22184bca37e356faadbfe846386880fb0898b773adb3a97d8c","src/event_database/mod.rs":"33519a9f648b6b8a014c23a47c8aa74420511027b9c6984e0c77a4e6192c02c6","src/fd_logger.rs":"0c9def6fa53db1a2ab93c85795f8a7df57797bcfd3978146923e151752e291a6","src/glean.udl":"74a2334177724f571eb6986015aa5514766472fccf1686e888baaa909881d6f2","src/glean_metrics.rs":"9414fb1453d19f6832df33e4c6ef7383d62203e47026bf5bc9552b083101ddd1","src/histogram/exponential.rs":"0f2c0857782d6910754a01438b1b4cd77bf0d3b847fd9ef969ba4da3705c5f5b","src/histogram/functional.rs":"22b2e64c3c1930e055beeebb832e3212e22b65b28e2ebb94c6bb3aff7ca31ba3","src/histogram/linear.rs":"bc33060cbbbb9c777539074cf5f788ab0f1a4ccecce0bf2cae2a697dd5089ea0","src/histogram/mod.rs":"c5eca9f6b0e1e309a7b41c2427d4c1da9c30e832d358d65ba347ba522abfd9c7","src/internal_metrics.rs":"54228cf409b4dd634fe0983f2619d2e0922efdd5fbce0f85a92454488967c854","src/internal_pings.rs":"3957a9fe256977a05d8d9e3beeec4c1fd08029db1c516fec4f6b59888e46ef39","src/lib.rs":"ac31e3136bd0077c33fe32554b39a0528a44396e4bb61d5a38b2978ffa52872b","src/lib_unit_tests.rs":"82ea06a5d6a8894c1670f99d0c236d8fa75eb9947fc8a1a53061a5e4c26b0b1d","src/metrics/boolean.rs":"2b9ef57e3582c9bd8b2cca8ab94c962a4871ecc00e837b913c9b0349ba9dff08","src/metrics/counter.rs":"b4a52a8167fb0edd6354f952525e59f3eadb4261de3483374f03c94449d30b92","src/metrics/custom_distribution.rs":"1ec4fd2ecebf547bef0ed28ae6854f641be447bcbf4066a8580f6af16a23e37f","src/metrics/datetime.rs":"e4405762fc71718299fa1b208e3d5fda654bd1b82fe908c884c284e3530de2ec","src/metrics/denominator.rs":"95e8442f90bad97f80fc74b146782f215344b52c5f3825ae0a8baffdc001a714","src/metrics/event.rs":"cd52e200d313e2e6f31707419d4a7fe1cab34916ee145f8136440d6da34aaad4","src/metrics/experiment.rs":"5f9278cca4e133eb8df33bbfe36d1fe0ef3eade8c09f1b46db3c4d0790515412","src/metrics/labeled.rs":"79acae98b7bd8536edcde5150c1402ed8560a8eb0ad5c04b79b7c67743d0aa71","src/metrics/memory_distribution.rs":"d3f02a6a78ed103024a2479975cd7617153e3f082e20f8f45c8e7afd052cec45","src/metrics/memory_unit.rs":"ee32e020cb303dd631457374048a3ed53a2e7cbacc29c54d17d836fb15507538","src/metrics/mod.rs":"777f89015c1642ed73536b07edc0763d179dbf608e2a0394439fe002cbc2fb53","src/metrics/numerator.rs":"937dfd583b797ac798a525cedca95c5a36262356760a89670d8113983c263154","src/metrics/object.rs":"2a1f1cc31973b576e55ba464b35c41b9420f62471eebba51273bca6856459538","src/metrics/ping.rs":"3b4524e8d17d55fe993746061636fb7d9566b51ac511765e173e7247907f0493","src/metrics/quantity.rs":"1315ae3216ebeec5b5a5baab88d63f88469875f538501e8320716516ef82bddf","src/metrics/rate.rs":"603cc45c149c7a27c93b6a80146bf43f8ce70d9655f905bb5be6bc2c15bcb22b","src/metrics/recorded_experiment.rs":"33958abee79d8b55dec4cb5d20742640423713010f76314075cefde18b5c118a","src/metrics/remote_settings_config.rs":"c85af9f9fef87ddfc578af4f2637c9bdcae18fbc6735ccc87a13a9b0ee0319ab","src/metrics/string.rs":"88beb1a847e5df9898b72ca7ed8ced3b7d2b40d83ff3670baf66f83a3e6cb005","src/metrics/string_list.rs":"ed53a095184c3e8224d0511809b5d7601ba3166505a39b0570f24ebeb0a5b97c","src/metrics/text.rs":"757f6919124d74e0512faa5bb9751a729b6bbc63ebe4d16ca81e9087f5595eaf","src/metrics/time_unit.rs":"4704703e19e799933aec3f39e3d3a125058756d7c7ba04f8729885c7843df447","src/metrics/timespan.rs":"e239c618f459c34f2799c73a4da3e3c6c0b2089ba42d584c2ddd12ed067586e6","src/metrics/timing_distribution.rs":"c61a2cd32a54e018b4b0bb60f030bada40fcbe68d6e6346eac8212cf416e14a3","src/metrics/url.rs":"589ae1f8047367ad8c19b57a48ca8130d5f36cf3ce5954124150f0eb89c620ea","src/metrics/uuid.rs":"cacffd95ab30ed327ec2fa5feaf1359e667706746401f1e2c1195ad9553c4b54","src/ping/mod.rs":"a4cc6b37443392aed79957a1b5d6943307e14bd3ead9fa9880c20aee48472ae2","src/scheduler.rs":"eb8131ed075e2d92bf0dc0a2c2a7e67c73bb61042d574c21965b1699cd1239aa","src/storage/mod.rs":"91f02556f113799e0d88d732ab342bda443f43461369e8b41c424c074d742591","src/system.rs":"e3d1b54e1d39cafe6f4dc7ff5021b08c879733f909951b0e1332b3efa9ed97bd","src/traits/boolean.rs":"be0e130f8043215705becc956d45b126c340568f1b24a396c0af9b4334a41ced","src/traits/counter.rs":"c686d26e131d854cd7a7df83c900ca7c17a03c663a30cf58ab48c7259476ce85","src/traits/custom_distribution.rs":"0bd1d425e4c059cca6af2dfb13c78e5e4c6c07fb46c7e31489ad0c5959854833","src/traits/datetime.rs":"636ac1456b1b042e38cf5ae6193c5b232ea0b80df62f583a2097891baef9641b","src/traits/event.rs":"a02235aae630aba7a45a3166b756927252b397af3ecdfab7236931e62725ac49","src/traits/labeled.rs":"1b2f8eea8d59e1635f64993936d880084a5e3f65cfd7a26ddf6968366890187d","src/traits/memory_distribution.rs":"55bb8f45e948319fbba9d28a50d8742da134b066a42e480887db7c7e435f4096","src/traits/mod.rs":"3560fdf3b81dceabbac9d97b0356aa8f883e477dcb787c81a09529047fda7161","src/traits/numerator.rs":"6e4f236bdc448f1bde7a8c249dcd086204c2c69990d3f444e746290929226ed3","src/traits/object.rs":"c03bad670ec7affbc578247f9e1904e898c1870b9bf25750c5094113f995623f","src/traits/ping.rs":"8831c106c03afeb458b0b028fa1ce61f056ebf8e82bc0a171a1bff255d920748","src/traits/quantity.rs":"6ffe25c913bef4315573d747308c182de740b2a4e02ba22cd21d0c33ba521f31","src/traits/rate.rs":"f000790440e0f389f0b160526a9a9a266e58d1405915ae56ac550f482858222c","src/traits/string.rs":"0c3c88382ff2e8eba89c7cfe129c4b84e31140af717819533c14919541ad790c","src/traits/string_list.rs":"14e56b62c2c2be1dd8013f12001f235b084abd2a0d5aa2f7932843877af49ac0","src/traits/text.rs":"8af7d3a0c87cfd8c6d33d6ad47532b431055bbdd395f9110da5630222c23cf93","src/traits/timespan.rs":"52be325a9c061916f34c5b638a07a93b4a14aa89fe365783103d2e06b998f547","src/traits/timing_distribution.rs":"0d35acddd9e35a7f8859cf007162460b5fd0bf06d205cd195ed1c857bbe58c42","src/traits/url.rs":"c27f7add23214ff051078b65b88120b620560d2841a1056c7214d5237e86b9e4","src/traits/uuid.rs":"81322e71c7e847bacaf827a2cd58f6193bdc208355524207f7f38db039da6aa8","src/upload/directory.rs":"363ddc345845c2d543f833a5a63f1c778455e68b36ac77ffce605cef29f0d5cb","src/upload/mod.rs":"edae31e4c2172fb1e8e8b2c5542812b1e29c3bfa2f1c7b08227cb7cc4260dd48","src/upload/policy.rs":"c250957a37783e74af8002cd80ba06ef9780a389fb0f61b8b665b79688f0a360","src/upload/request.rs":"de5532fc3d18e773330c05fe000643d87b9c4912a2d838099b8783538c5033ed","src/upload/result.rs":"c956266c54595d27d5e8b11abffe28fad5fea82995922618805b66cfdcc21d54","src/util.rs":"ee7500434d9758a320dd410f18d7e18da956591e19d2555db87eef9623e4b916","tests/boolean.rs":"76d6014ff108cb6514d9bceb1b2b14749a55b09921f4595a5e30f1bd3546e9f0","tests/collection_enabled.rs":"85f4b2eb49ac23437ae225ae2c44f354c952c24b7c806e2f2ee5dbe78e02c8db","tests/common/mod.rs":"a8f74c906dccfe747d5cf9dd83dd6e4d1ef25d0402d39a2d74105cddab80e54c","tests/counter.rs":"4c59def10e64de0d7a0241dde0267fd02c828b38be8cc67fba90a76004ca6721","tests/custom_distribution.rs":"41c593a0b4561e21f29d1a5b948de964a866253c58ca76ffefebe370fca150e0","tests/datetime.rs":"ec3c9760e70bb2cbc61ab23281c891bc1ec493c5c545466c29fd13e4f05c2c96","tests/event.rs":"5db675dad1bcbcee0451bfe5e93f05f28d7ef8098d19cd302c8bac262567cf0c","tests/labeled.rs":"3efddb05556e92a372f50a19b025ecf4ccd818c7c477250058db0706eb992079","tests/memory_distribution.rs":"3d9a5b8f99e03f783e3396e4320ee4dc974c895cfef2cec0b14d2a9a9f9b736f","tests/object.rs":"8c35676e04f6ccf54a28764700915e753fc0355bfa5d7804d72caba66fd564cd","tests/ping.rs":"eff68d3b47b04c58d8123214dd66e8d06d11f82ed3fd4f703224f84effb319bb","tests/ping_maker.rs":"64900bb24642127df559fa6ace4c7f0a4a4bf858321874c9b3758039df0ffa04","tests/quantity.rs":"55e7dca346fd1d27f0974b78ca3fb12427cb5da2ee637afc08a54f360f947361","tests/rate.rs":"94a3a7d0ccafea02a991ed9dd038cbfab8a534695b374b1ce6ed81285616e9f6","tests/storage.rs":"990dd1d13b9ffa8af0686977a6ac3502c6befb9eaa83649587e2660f51c596c9","tests/string.rs":"397fcfd27c25f0e81e2a40db3265b0d7dc0dd56b190319c1f86cb1c2c0ed4f9d","tests/string_list.rs":"34efa2afe3e89e6635f21ec9c80650d5816e35e9cb85163d894d600a5b3a4e3a","tests/text.rs":"1d43f6b90a43124311cacf0a6ee16f9e1e9263bcd11fee8b996d6efd81633638","tests/timespan.rs":"3d05739a93f3e0ea7264e8fdea876bd948714e5b44e82b8fd7c0218fdb597bb3","tests/timing_distribution.rs":"072ad950b2162e503150e411119b9a000573538bd2cff93c1c1a3616d1589ef4","tests/uuid.rs":"e0e58614319f5e973126f5b4e68d9289ccd6d65e428aca215bf7dcc8a0504889","uniffi.toml":"6ddc98b686b0925a81abd9d1c769e5c98ac29771b210a1c535931a46dec9a8e3"},"package":"5ca0df94fb37669287b77e8aa300913ad1d14426d7f9e443b0ce1185349c817e"} \ No newline at end of file diff --git a/third_party/rust/glean-core/Cargo.toml b/third_party/rust/glean-core/Cargo.toml index f4a8c1f6e9cd..32ff1696c184 100644 --- a/third_party/rust/glean-core/Cargo.toml +++ b/third_party/rust/glean-core/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.82" name = "glean-core" -version = "64.0.1" +version = "64.1.1" authors = [ "Jan-Erik Rediger ", "The Glean Team ", @@ -40,7 +40,7 @@ license = "MPL-2.0" repository = "https://github.com/mozilla/glean" [package.metadata.glean] -glean-parser = "17.0.1" +glean-parser = "17.1.0" [lib] name = "glean_core" diff --git a/third_party/rust/glean-core/src/core/mod.rs b/third_party/rust/glean-core/src/core/mod.rs index 302f90d134e5..d60af5363dc9 100644 --- a/third_party/rust/glean-core/src/core/mod.rs +++ b/third_party/rust/glean-core/src/core/mod.rs @@ -24,8 +24,9 @@ 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, PingRateLimit, - Result, DEFAULT_MAX_EVENTS, GLEAN_SCHEMA_VERSION, GLEAN_VERSION, KNOWN_CLIENT_ID, + scheduler, system, AttributionMetrics, CommonMetricData, DistributionMetrics, ErrorKind, + InternalConfiguration, Lifetime, PingRateLimit, Result, DEFAULT_MAX_EVENTS, + GLEAN_SCHEMA_VERSION, GLEAN_VERSION, KNOWN_CLIENT_ID, }; static GLEAN: OnceCell> = OnceCell::new(); @@ -1084,4 +1085,76 @@ impl Glean { scheduler::schedule(self); } } + + /// Updates attribution fields with new values. + /// AttributionMetrics fields with `None` values will not overwrite older values. + pub fn update_attribution(&self, attribution: AttributionMetrics) { + if let Some(source) = attribution.source { + self.core_metrics.attribution_source.set_sync(self, source); + } + if let Some(medium) = attribution.medium { + self.core_metrics.attribution_medium.set_sync(self, medium); + } + if let Some(campaign) = attribution.campaign { + self.core_metrics + .attribution_campaign + .set_sync(self, campaign); + } + if let Some(term) = attribution.term { + self.core_metrics.attribution_term.set_sync(self, term); + } + if let Some(content) = attribution.content { + self.core_metrics + .attribution_content + .set_sync(self, content); + } + } + + /// **TEST-ONLY Method** + /// + /// Returns the current attribution metrics. + pub fn test_get_attribution(&self) -> AttributionMetrics { + AttributionMetrics { + source: self + .core_metrics + .attribution_source + .get_value(self, Some("glean_client_info")), + medium: self + .core_metrics + .attribution_medium + .get_value(self, Some("glean_client_info")), + campaign: self + .core_metrics + .attribution_campaign + .get_value(self, Some("glean_client_info")), + term: self + .core_metrics + .attribution_term + .get_value(self, Some("glean_client_info")), + content: self + .core_metrics + .attribution_content + .get_value(self, Some("glean_client_info")), + } + } + + /// Updates distribution fields with new values. + /// DistributionMetrics fields with `None` values will not overwrite older values. + pub fn update_distribution(&self, distribution: DistributionMetrics) { + if let Some(name) = distribution.name { + self.core_metrics.distribution_name.set_sync(self, name); + } + } + + /// **TEST-ONLY Method** + /// + /// Returns the current distribution metrics. + pub fn test_get_distribution(&self) -> DistributionMetrics { + DistributionMetrics { + name: self + .core_metrics + .distribution_name + .get_value(self, Some("glean_client_info")), + } + } } diff --git a/third_party/rust/glean-core/src/core_metrics.rs b/third_party/rust/glean-core/src/core_metrics.rs index baa2b8515bca..c3ed9f2ec458 100644 --- a/third_party/rust/glean-core/src/core_metrics.rs +++ b/third_party/rust/glean-core/src/core_metrics.rs @@ -42,6 +42,58 @@ pub struct ClientInfoMetrics { pub locale: Option, } +/// Optional product attribution metrics carried in `client_info.attribution`. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct AttributionMetrics { + /// The attribution source (e.g. "google-play"). + pub source: Option, + /// The attribution medium (e.g. "organic" for a search engine). + pub medium: Option, + /// The attribution campaign (e.g. "mozilla-org"). + pub campaign: Option, + /// The attribution term (e.g. "browser with developer tools for android"). + pub term: Option, + /// The attribution content (e.g. "firefoxview"). + pub content: Option, +} + +impl AttributionMetrics { + /// Update self with any non-`None` fields from `other`. + pub fn update(&mut self, other: AttributionMetrics) { + if let Some(source) = other.source { + self.source = Some(source); + } + if let Some(medium) = other.medium { + self.medium = Some(medium); + } + if let Some(campaign) = other.campaign { + self.campaign = Some(campaign); + } + if let Some(term) = other.term { + self.term = Some(term); + } + if let Some(content) = other.content { + self.content = Some(content); + } + } +} + +/// Optional product distribution metrics carried in `client_info.distribution`. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DistributionMetrics { + /// The distribution name (e.g. "MozillaOnline"). + pub name: Option, +} + +impl DistributionMetrics { + /// Update self with any non-`None` fields from `other`. + pub fn update(&mut self, other: DistributionMetrics) { + if let Some(name) = other.name { + self.name = Some(name); + } + } +} + /// Metrics included in every ping as `client_info`. impl ClientInfoMetrics { /// Creates the client info with dummy values for all. @@ -204,3 +256,62 @@ pub mod internal_metrics { ) }); } + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn update_attribution() { + let mut attr: AttributionMetrics = Default::default(); + let empty: AttributionMetrics = Default::default(); + + // Ensure the identity operation works. + attr.update(empty.clone()); + assert_eq!(None, attr.source); + + // Ensure simple updates work. + attr.update(AttributionMetrics { + source: Some("a source".into()), + ..Default::default() + }); + assert_eq!(Some("a source".into()), attr.source); + + // Ensure None doesn't overwrite. + attr.update(empty); + assert_eq!(Some("a source".into()), attr.source); + + // Ensure updates of Some work. + attr.update(AttributionMetrics { + source: Some("another source".into()), + ..Default::default() + }); + assert_eq!(Some("another source".into()), attr.source); + } + + #[test] + fn update_distribution() { + let mut dist: DistributionMetrics = Default::default(); + let empty: DistributionMetrics = Default::default(); + + // Ensure the identity operation works. + dist.update(empty.clone()); + assert_eq!(None, dist.name); + + // Ensure simple updates work. + dist.update(DistributionMetrics { + name: Some("a name".into()), + }); + assert_eq!(Some("a name".into()), dist.name); + + // Ensure None doesn't overwrite. + dist.update(empty); + assert_eq!(Some("a name".into()), dist.name); + + // Ensure updates of Some work. + dist.update(DistributionMetrics { + name: Some("another name".into()), + }); + assert_eq!(Some("another name".into()), dist.name); + } +} diff --git a/third_party/rust/glean-core/src/glean.udl b/third_party/rust/glean-core/src/glean.udl index d8f3aa179052..fb7cdfe69e2d 100644 --- a/third_party/rust/glean-core/src/glean.udl +++ b/third_party/rust/glean-core/src/glean.udl @@ -71,6 +71,18 @@ namespace glean { PingUploadTask glean_get_upload_task(); UploadTaskAction glean_process_ping_upload_response(string uuid, UploadResult result); + + // Updates attribution fields with new values. + // AttributionMetrics fields with no values will not overwrite older values. + void glean_update_attribution(AttributionMetrics attribution); + // Returns the current attribution metrics, if any. + AttributionMetrics glean_test_get_attribution(); + + // Updates distribution fields with new values. + // DistributionMetrics fields with no values will not overwrite older values. + void glean_update_distribution(DistributionMetrics distribution); + // Returns the current distribution metrics, if any. + DistributionMetrics glean_test_get_distribution(); }; // A `Cow<'static, str>`, but really it's always the owned part. @@ -138,6 +150,18 @@ dictionary ClientInfoMetrics { i64? windows_build_number = null; }; +dictionary AttributionMetrics { + string? source = null; + string? medium = null; + string? campaign = null; + string? term = null; + string? content = null; +}; + +dictionary DistributionMetrics { + string? name = null; +}; + [Error] enum CallbackError { "UnexpectedError", diff --git a/third_party/rust/glean-core/src/internal_metrics.rs b/third_party/rust/glean-core/src/internal_metrics.rs index 7c0f697eed6c..372ec32a9ad5 100644 --- a/third_party/rust/glean-core/src/internal_metrics.rs +++ b/third_party/rust/glean-core/src/internal_metrics.rs @@ -11,6 +11,12 @@ pub struct CoreMetrics { pub client_id: UuidMetric, pub first_run_date: DatetimeMetric, pub os: StringMetric, + pub attribution_source: StringMetric, + pub attribution_medium: StringMetric, + pub attribution_campaign: StringMetric, + pub attribution_term: StringMetric, + pub attribution_content: StringMetric, + pub distribution_name: StringMetric, } #[derive(Debug)] @@ -65,6 +71,60 @@ impl CoreMetrics { disabled: false, dynamic_label: None, }), + + attribution_source: StringMetric::new(CommonMetricData { + name: "source".into(), + category: "attribution".into(), + send_in_pings: vec!["glean_client_info".into()], + lifetime: Lifetime::User, + disabled: false, + dynamic_label: None, + }), + + attribution_medium: StringMetric::new(CommonMetricData { + name: "medium".into(), + category: "attribution".into(), + send_in_pings: vec!["glean_client_info".into()], + lifetime: Lifetime::User, + disabled: false, + dynamic_label: None, + }), + + attribution_campaign: StringMetric::new(CommonMetricData { + name: "campaign".into(), + category: "attribution".into(), + send_in_pings: vec!["glean_client_info".into()], + lifetime: Lifetime::User, + disabled: false, + dynamic_label: None, + }), + + attribution_term: StringMetric::new(CommonMetricData { + name: "term".into(), + category: "attribution".into(), + send_in_pings: vec!["glean_client_info".into()], + lifetime: Lifetime::User, + disabled: false, + dynamic_label: None, + }), + + attribution_content: StringMetric::new(CommonMetricData { + name: "content".into(), + category: "attribution".into(), + send_in_pings: vec!["glean_client_info".into()], + lifetime: Lifetime::User, + disabled: false, + dynamic_label: None, + }), + + distribution_name: StringMetric::new(CommonMetricData { + name: "name".into(), + category: "distribution".into(), + send_in_pings: vec!["glean_client_info".into()], + lifetime: Lifetime::User, + disabled: false, + dynamic_label: None, + }), } } } diff --git a/third_party/rust/glean-core/src/lib.rs b/third_party/rust/glean-core/src/lib.rs index aac594e20992..50da8bb8dfaf 100644 --- a/third_party/rust/glean-core/src/lib.rs +++ b/third_party/rust/glean-core/src/lib.rs @@ -59,7 +59,7 @@ mod fd_logger; pub use crate::common_metric_data::{CommonMetricData, Lifetime}; pub use crate::core::Glean; -pub use crate::core_metrics::ClientInfoMetrics; +pub use crate::core_metrics::{AttributionMetrics, ClientInfoMetrics, DistributionMetrics}; pub use crate::error::{Error, ErrorKind, Result}; pub use crate::error_recording::{test_get_num_recorded_errors, ErrorType}; pub use crate::histogram::HistogramType; @@ -102,6 +102,10 @@ static PRE_INIT_SOURCE_TAGS: Mutex> = Mutex::new(Vec::new()); static PRE_INIT_PING_REGISTRATION: Mutex> = Mutex::new(Vec::new()); static PRE_INIT_PING_ENABLED: Mutex> = Mutex::new(Vec::new()); +/// Keep track of attribution and distribution supplied before Glean is initialized. +static PRE_INIT_ATTRIBUTION: Mutex> = Mutex::new(None); +static PRE_INIT_DISTRIBUTION: Mutex> = Mutex::new(None); + /// Global singleton of the handles of the glean.init threads. /// For joining. For tests. /// (Why a Vec? There might be more than one concurrent call to initialize.) @@ -448,6 +452,15 @@ fn initialize_inner( glean.set_ping_enabled(ping, *enabled); } + // The attribution and distribution might have been set before initialize, + // take the cached values and set them. + if let Some(attribution) = PRE_INIT_ATTRIBUTION.lock().unwrap().take() { + glean.update_attribution(attribution); + } + if let Some(distribution) = PRE_INIT_DISTRIBUTION.lock().unwrap().take() { + glean.update_distribution(distribution); + } + // If this is the first time ever the Glean SDK runs, make sure to set // some initial core metrics in case we need to generate early pings. // The next times we start, we would have them around already. @@ -874,7 +887,7 @@ pub fn glean_set_collection_enabled(enabled: bool) { /// and all pending pings of that type to be deleted. pub fn set_ping_enabled(ping: &PingType, enabled: bool) { let ping = ping.clone(); - if was_initialize_called() { + if was_initialize_called() && core::global_glean().is_some() { crate::launch_with_glean_mut(move |glean| glean.set_ping_enabled(&ping, enabled)); } else { let m = &PRE_INIT_PING_ENABLED; @@ -889,7 +902,7 @@ pub(crate) fn register_ping_type(ping: &PingType) { // we dispatch ping registration on the thread pool. // Registering a ping should not block the application. // Submission itself is also dispatched, so it will always come after the registration. - if was_initialize_called() { + if was_initialize_called() && core::global_glean().is_some() { let ping = ping.clone(); crate::launch_with_glean_mut(move |glean| { glean.register_ping_type(&ping); @@ -1003,7 +1016,7 @@ pub fn glean_apply_server_knobs_config(json: String) { /// This will return `false` in case `tag` is not a valid tag and `true` otherwise. /// If called before Glean is initialized it will always return `true`. pub fn glean_set_debug_view_tag(tag: String) -> bool { - if was_initialize_called() { + if was_initialize_called() && core::global_glean().is_some() { crate::launch_with_glean_mut(move |glean| { glean.set_debug_view_tag(&tag); }); @@ -1041,7 +1054,7 @@ pub fn glean_get_debug_view_tag() -> Option { /// * `tags` - A vector of at most 5 valid HTTP header values. Individual /// tags must match the regex: "[a-zA-Z0-9-]{1,20}". pub fn glean_set_source_tags(tags: Vec) -> bool { - if was_initialize_called() { + if was_initialize_called() && core::global_glean().is_some() { crate::launch_with_glean_mut(|glean| { glean.set_source_tags(tags); }); @@ -1066,7 +1079,7 @@ pub fn glean_set_source_tags(tags: Vec) -> bool { /// /// * `value` - The value of the log pings option pub fn glean_set_log_pings(value: bool) { - if was_initialize_called() { + if was_initialize_called() && core::global_glean().is_some() { crate::launch_with_glean_mut(move |glean| { glean.set_log_pings(value); }); @@ -1163,7 +1176,8 @@ pub fn glean_submit_ping_by_name_sync(ping_name: String, reason: Option) return false; } - core::with_glean(|glean| glean.submit_ping_by_name(&ping_name, reason.as_deref())) + core::with_opt_glean(|glean| glean.submit_ping_by_name(&ping_name, reason.as_deref())) + .unwrap_or(false) } /// EXPERIMENTAL: Register a listener object to recieve notifications of event recordings. @@ -1255,6 +1269,52 @@ pub fn glean_set_dirty_flag(new_value: bool) { core::with_glean(|glean| glean.set_dirty_flag(new_value)) } +/// Updates attribution fields with new values. +/// AttributionMetrics fields with `None` values will not overwrite older values. +pub fn glean_update_attribution(attribution: AttributionMetrics) { + if was_initialize_called() && core::global_glean().is_some() { + core::with_glean(|glean| glean.update_attribution(attribution)); + } else { + PRE_INIT_ATTRIBUTION + .lock() + .unwrap() + .get_or_insert(Default::default()) + .update(attribution); + } +} + +/// **TEST-ONLY Method** +/// +/// Returns the current attribution metrics. +/// Panics if called before init. +pub fn glean_test_get_attribution() -> AttributionMetrics { + join_init(); + core::with_glean(|glean| glean.test_get_attribution()) +} + +/// Updates distribution fields with new values. +/// DistributionMetrics fields with `None` values will not overwrite older values. +pub fn glean_update_distribution(distribution: DistributionMetrics) { + if was_initialize_called() && core::global_glean().is_some() { + core::with_glean(|glean| glean.update_distribution(distribution)); + } else { + PRE_INIT_DISTRIBUTION + .lock() + .unwrap() + .get_or_insert(Default::default()) + .update(distribution); + } +} + +/// **TEST-ONLY Method** +/// +/// Returns the current distribution metrics. +/// Panics if called before init. +pub fn glean_test_get_distribution() -> DistributionMetrics { + join_init(); + core::with_glean(|glean| glean.test_get_distribution()) +} + #[cfg(all(not(target_os = "android"), not(target_os = "ios")))] static FD_LOGGER: OnceCell = OnceCell::new(); diff --git a/third_party/rust/glean-core/src/lib_unit_tests.rs b/third_party/rust/glean-core/src/lib_unit_tests.rs index 005cf92b4165..5b17597f3e46 100644 --- a/third_party/rust/glean-core/src/lib_unit_tests.rs +++ b/third_party/rust/glean-core/src/lib_unit_tests.rs @@ -396,6 +396,58 @@ fn client_id_is_set_to_random_value_when_uploading_enabled_at_start() { assert_ne!(*KNOWN_CLIENT_ID, current_client_id.unwrap()); } +#[test] +fn attribution_and_distribution_are_correctly_stored() { + let dir = tempfile::tempdir().unwrap(); + let tmpname = dir.path().display().to_string(); + let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, true); + + // On a fresh Glean, no attribution or distribution information is set. + assert_eq!( + ::default(), + glean.test_get_attribution() + ); + assert_eq!( + ::default(), + glean.test_get_distribution() + ); + + let mut attribution = AttributionMetrics { + source: Some("source".into()), + medium: Some("medium".into()), + campaign: Some("campaign".into()), + term: Some("term".into()), + content: Some("content".into()), + }; + let distribution = DistributionMetrics { + name: Some("name".into()), + }; + + // Set them all at once. + glean.update_attribution(attribution.clone()); + glean.update_distribution(distribution.clone()); + + assert_eq!(attribution, glean.test_get_attribution()); + assert_eq!(distribution, glean.test_get_distribution()); + + let attribution_update = AttributionMetrics { + campaign: Some("new campaign".into()), + ..Default::default() + }; + let distribution_update = DistributionMetrics { + name: Some("new name".into()), + }; + + // Perform updates. + glean.update_attribution(attribution_update); + glean.update_distribution(distribution_update.clone()); + + // Ensure only the updated fields took over + attribution.campaign = Some("new campaign".into()); + assert_eq!(attribution, glean.test_get_attribution()); + assert_eq!(distribution_update, glean.test_get_distribution()); +} + #[test] fn enabling_when_already_enabled_is_a_noop() { let dir = tempfile::tempdir().unwrap(); diff --git a/third_party/rust/glean-core/src/metrics/labeled.rs b/third_party/rust/glean-core/src/metrics/labeled.rs index 4824a6999d00..fd15e4c18b84 100644 --- a/third_party/rust/glean-core/src/metrics/labeled.rs +++ b/third_party/rust/glean-core/src/metrics/labeled.rs @@ -17,7 +17,7 @@ use crate::Glean; const MAX_LABELS: usize = 16; const OTHER_LABEL: &str = "__other__"; -const MAX_LABEL_LENGTH: usize = 71; +const MAX_LABEL_LENGTH: usize = 111; /// A labeled counter. pub type LabeledCounter = LabeledMetric; @@ -265,7 +265,7 @@ where /// only the first 16 unique labels will be used. /// After that, any additional labels will be recorded under the special `OTHER_LABEL` label. /// - /// Labels must be `snake_case` and less than 30 characters. + /// Labels must have a maximum of 111 characters, and may comprise any printable ASCII characters. /// If an invalid label is used, the metric will be recorded in the special `OTHER_LABEL` label. pub fn get>(&self, label: S) -> Arc { let label = label.as_ref(); diff --git a/third_party/rust/glean-core/src/ping/mod.rs b/third_party/rust/glean-core/src/ping/mod.rs index 089c38d8caf0..cd52427c4747 100644 --- a/third_party/rust/glean-core/src/ping/mod.rs +++ b/third_party/rust/glean-core/src/ping/mod.rs @@ -176,8 +176,36 @@ impl PingMaker { StorageManager.snapshot_as_json(glean.storage(), "glean_client_info", true) { let client_info_obj = client_info.as_object().unwrap(); // safe unwrap, snapshot always returns an object. - for (_key, value) in client_info_obj { - merge(&mut map, value); + for (_metric_type, metrics) in client_info_obj { + merge(&mut map, metrics); + } + let map = map.as_object_mut().unwrap(); // safe unwrap, we created the object above. + let mut attribution = serde_json::Map::new(); + let mut distribution = serde_json::Map::new(); + map.retain(|name, value| { + // Only works because we ensure no client_info metric categories contain '.'. + let mut split = name.split('.'); + let category = split.next(); + let name = split.next(); + if let (Some(category), Some(name)) = (category, name) { + if category == "attribution" { + attribution.insert(name.into(), value.take()); + false + } else if category == "distribution" { + distribution.insert(name.into(), value.take()); + false + } else { + true + } + } else { + true + } + }); + if !attribution.is_empty() { + map.insert("attribution".into(), serde_json::Value::from(attribution)); + } + if !distribution.is_empty() { + map.insert("distribution".into(), serde_json::Value::from(distribution)); } } else { log::warn!("Empty client info data."); diff --git a/third_party/rust/glean-core/src/traits/labeled.rs b/third_party/rust/glean-core/src/traits/labeled.rs index 2979ee2ee901..54f937a23866 100644 --- a/third_party/rust/glean-core/src/traits/labeled.rs +++ b/third_party/rust/glean-core/src/traits/labeled.rs @@ -21,7 +21,7 @@ where /// only the first 16 unique labels will be used. /// After that, any additional labels will be recorded under the special `OTHER_LABEL` label. /// - /// Labels must be `snake_case` and less than 30 characters. + /// Labels must have a maximum of 111 characters, and may comprise any printable ASCII characters. /// If an invalid label is used, the metric will be recorded in the special `OTHER_LABEL` label. fn get(&self, label: &str) -> T; diff --git a/third_party/rust/glean-core/tests/labeled.rs b/third_party/rust/glean-core/tests/labeled.rs index 69687d3737fb..bd999c4d5151 100644 --- a/third_party/rust/glean-core/tests/labeled.rs +++ b/third_party/rust/glean-core/tests/labeled.rs @@ -387,7 +387,7 @@ fn dynamic_labels_too_long() { None, ); - let metric = labeled.get("1".repeat(72)); + let metric = labeled.get("1".repeat(112)); metric.add_sync(&glean, 1); let snapshot = StorageManager diff --git a/third_party/rust/glean-core/tests/ping_maker.rs b/third_party/rust/glean-core/tests/ping_maker.rs index 2d51f648b4de..6cd15b62f475 100644 --- a/third_party/rust/glean-core/tests/ping_maker.rs +++ b/third_party/rust/glean-core/tests/ping_maker.rs @@ -4,6 +4,8 @@ mod common; use crate::common::*; +use glean_core::{AttributionMetrics, DistributionMetrics}; +use serde_json::json; use glean_core::metrics::*; use glean_core::ping::PingMaker; @@ -306,3 +308,69 @@ fn metadata_is_correctly_added_when_necessary() { let headers = metadata.as_ref().unwrap().get("headers").unwrap(); assert_eq!(headers.get("X-Debug-ID").unwrap(), "valid-tag"); } + +#[test] +fn attribution_and_distribution_appear_in_client_info() { + let (glean, ping_maker, ping_type, _t) = set_up_basic_ping(); + + let attribution = AttributionMetrics { + source: Some("source".into()), + medium: Some("medium".into()), + campaign: Some("campaign".into()), + term: Some("term".into()), + content: Some("content".into()), + }; + let distribution = DistributionMetrics { + name: Some("name".into()), + }; + glean.update_attribution(attribution); + glean.update_distribution(distribution); + + let ping = ping_maker + .collect(&glean, &ping_type, None, "", "") + .unwrap(); + let client_info = ping.content["client_info"].as_object().unwrap(); + + assert_eq!(json!({"name": "name"}), client_info["distribution"]); + assert_eq!( + json!({ + "source": "source", + "medium": "medium", + "campaign": "campaign", + "term": "term", + "content": "content", + }), + client_info["attribution"] + ); + + // Now let's test updated values. + let attribution_update = AttributionMetrics { + content: Some("what a boring word".into()), + ..Default::default() + }; + let distribution_update = DistributionMetrics { + name: Some("what's in a name".into()), + }; + glean.update_attribution(attribution_update); + glean.update_distribution(distribution_update); + + let ping = ping_maker + .collect(&glean, &ping_type, None, "", "") + .unwrap(); + let client_info = ping.content["client_info"].as_object().unwrap(); + + assert_eq!( + json!({"name": "what's in a name"}), + client_info["distribution"] + ); + assert_eq!( + json!({ + "source": "source", + "medium": "medium", + "campaign": "campaign", + "term": "term", + "content": "what a boring word", + }), + client_info["attribution"] + ); +} diff --git a/third_party/rust/glean/.cargo-checksum.json b/third_party/rust/glean/.cargo-checksum.json index 794bfa5e8c90..ad172ae53bd1 100644 --- a/third_party/rust/glean/.cargo-checksum.json +++ b/third_party/rust/glean/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.lock":"61c7d6620026e84a7bb067305d92ffb8c51a59261c339d3ef6a8406d03bbfd92","Cargo.toml":"bec966c61ac0670d367556c54f9156aad7b2cd72dce2d09c783fdf421f49c563","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"5627cc81e6187ab6c2b4dff061af16d559edcab64ba786bac39daa69c703c595","src/common_test.rs":"c86cccfb7da1506cfed29cb2ee13d839b7ac7cffdfd70793c9665bb44e0b684f","src/configuration.rs":"de65ab99a26b4547be20803bc195cb50a6ab40b1a3f49a2e6230fed5a9d7a8d8","src/core_metrics.rs":"fef8fb4e5fa57c179836c6eb2cf59278fe3b8b036dbe57b0ff02971b4acd822f","src/lib.rs":"61b56a35c2bc6cd60bba2225b399881512d4b9a7d8cadca7fbed37ee6959d74c","src/net/http_uploader.rs":"0a94ac3cd87cb021529dee46d537765ab8d923e0f4ac7615225e878d3739e6dc","src/net/mod.rs":"09ba010b03d045fd8a2ccbe4f205c5275bb622bceb34cb81a0aa8f7d33804e2e","src/private/event.rs":"f299c79e4e2acb657f06004f3038bd8909e287719458566bc7f96262d8665e62","src/private/mod.rs":"66e90c41de74d1e80c5d3f49b8f1a86b8396be0b8c4a80f1a28903fe6d105ecf","src/private/object.rs":"7f17a7a658e8f7aa19a6bedf70f60f3f42713316d5d60298d682bb045caaafb7","src/private/ping.rs":"d2fb45e9e178ff6b17aa9c1b5258dfcd2ed91a2b43b44dec826de256ef5e8520","src/system.rs":"d602804a72258bfd65e51c571946631732ee27d81342d8aa406e47fdd241bbfa","src/test.rs":"bfbea9416dfdc96ebc1f9af5005b5b23f2285b74ef82c74cdab11635322ea3e3","tests/collection_enabled.rs":"3327a949dbdeec493d661261abda68ffa71acc50ab24cba4fde5302749e6f16b","tests/collection_enabled_bin.rs":"d3a6458b84012a447e5cb792f2292a06951ed252fad803b9166b437bacba542c","tests/common/mod.rs":"2fd391c5eb45f56fdfa3261dd631406c67ed36b10b0d5432febe2483da5c9d89","tests/custom_distribution_buffered.rs":"47c13d1f39adf3881e10caa19e0c08235f08958809e234bf37a79d37d7322cd5","tests/init_fails.rs":"ca7fa1b3dd6a21a9e005b7a4f0a18664c4bceb952dd463db8316500f72280d5b","tests/interruptible_shutdown.rs":"3d954bbe47d4f5fd103c51a4ff99f151662143c25c826da9734a00cd215909b9","tests/memory_distribution_buffered.rs":"db487475a5cf17a0864ccf150984ebdd28bf616573772cf678246cc1bdbcbc0f","tests/metric_metadata.rs":"05c947d3decf0a3281378dbb108080a05319ad8f130af5b07f9b049b80e5f04f","tests/near-empty-c0ffee-db.safe.bin":"89afb3bb8fc94430fb0ed0fe55f85f3f8bcc8fd0fed69a9df13cc560294ec9f5","tests/never_init.rs":"51fff5618f6603bc0945d70131698d10a1c6275f43bbc22a2de5807f8a79229f","tests/no_time_to_init.rs":"2ede23df6618ff1cb5ae3b7bbf95900ad0fd92072afa2e0319bf147b4f75cefc","tests/overflowing_preinit.rs":"985e140460a100986fd051ce901b787a3a7a9747a856cd06066b740ac7d2381c","tests/persist_ping_lifetime_nopanic.rs":"18379d3ffbf4a2c8c684c04ff7a0660b86dfbbb447db2d24dfed6073cb7ddf8f","tests/schema.rs":"23b49005402b914e55a0c5c155f30c2662c609f79be78d1385ec25b3600b3547","tests/simple.rs":"15c76a1b5a336fd6abfbdebafc971f5c6a9b75107ddbca65f0031cde3e2886da","tests/test-delayed-ping-data.sh":"4a6db98b4df6b77898ace6a8b4e8b4c60d3e5c44873bbf38c62e83583e27a3ff","tests/test-enabled-pings.sh":"06656e38f63e65475006b107dd6bd179b0cbaa1fad1470de38e679e91a9315a3","tests/test-pending-gets-removed.sh":"e335f2f00fa97a61b6d94e0005fb3b9de8c8db8076111a67ca47d85392039ea9","tests/test-ping-lifetime-flush.sh":"e8f118ea2f6fd973809e38d5e828a03cfccfe0b0f497ccde5ec92d6d1380c071","tests/test-shutdown-blocking.sh":"a44d8d4bbe2ee3ede9e48121150ae7a5386025160c5cef2181ca142232c5fb27","tests/test-thread-crashing.sh":"f3cd0cc8a7b4fe82bef0fe6fbfbbe45fbad6da3afe0f82578bc5cfb2d6527ac6","tests/timing_distribution_buffered.rs":"501f7289c0c28f0ab83838c88b058999b19436d0f2b693be0787513d7b67e06d","tests/timing_distribution_single_sample.rs":"4f9498b6ef29913da0356027efe5f572c81d2f426e8538c068b54a1cfa33c1b8","tests/upload_timing.rs":"b3b9db197bc2ec41556388969a6bf289e7ef19e05b9019bc2bd98c823fcf6ea3","tests/uploader_capabilities.rs":"347f19e534a50a211ea179d6818631270d1b4ec468098e6b6abcde1e4a6a9bca"},"package":"251b9cb685554b96dcf785dba69ce90447006dd6d9229db783336c981c3777e1"} \ No newline at end of file +{"files":{"Cargo.lock":"add20d32d164cac0a56ddac41468eaf0b23b9616f32e94a8434f5841d14b3a97","Cargo.toml":"99107d6ac4ef4ff33e2d206e8498875df879001e4621ba94e9d4ccf14267f39c","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"5627cc81e6187ab6c2b4dff061af16d559edcab64ba786bac39daa69c703c595","src/common_test.rs":"c86cccfb7da1506cfed29cb2ee13d839b7ac7cffdfd70793c9665bb44e0b684f","src/configuration.rs":"de65ab99a26b4547be20803bc195cb50a6ab40b1a3f49a2e6230fed5a9d7a8d8","src/core_metrics.rs":"fef8fb4e5fa57c179836c6eb2cf59278fe3b8b036dbe57b0ff02971b4acd822f","src/lib.rs":"998359d04ba0f71aaa360b8999c716f22c9efaf1ff4e1fdce80f1d3af5e584b0","src/net/http_uploader.rs":"0a94ac3cd87cb021529dee46d537765ab8d923e0f4ac7615225e878d3739e6dc","src/net/mod.rs":"09ba010b03d045fd8a2ccbe4f205c5275bb622bceb34cb81a0aa8f7d33804e2e","src/private/event.rs":"f299c79e4e2acb657f06004f3038bd8909e287719458566bc7f96262d8665e62","src/private/mod.rs":"66e90c41de74d1e80c5d3f49b8f1a86b8396be0b8c4a80f1a28903fe6d105ecf","src/private/object.rs":"7f17a7a658e8f7aa19a6bedf70f60f3f42713316d5d60298d682bb045caaafb7","src/private/ping.rs":"d2fb45e9e178ff6b17aa9c1b5258dfcd2ed91a2b43b44dec826de256ef5e8520","src/system.rs":"d602804a72258bfd65e51c571946631732ee27d81342d8aa406e47fdd241bbfa","src/test.rs":"8ff4d5072d23d9fbf5444e474d21b41a31e86a37e2a25fc2f2a92976e7642cbb","tests/collection_enabled.rs":"3327a949dbdeec493d661261abda68ffa71acc50ab24cba4fde5302749e6f16b","tests/collection_enabled_bin.rs":"d3a6458b84012a447e5cb792f2292a06951ed252fad803b9166b437bacba542c","tests/common/mod.rs":"2fd391c5eb45f56fdfa3261dd631406c67ed36b10b0d5432febe2483da5c9d89","tests/custom_distribution_buffered.rs":"47c13d1f39adf3881e10caa19e0c08235f08958809e234bf37a79d37d7322cd5","tests/init_fails.rs":"ca7fa1b3dd6a21a9e005b7a4f0a18664c4bceb952dd463db8316500f72280d5b","tests/interruptible_shutdown.rs":"3d954bbe47d4f5fd103c51a4ff99f151662143c25c826da9734a00cd215909b9","tests/memory_distribution_buffered.rs":"db487475a5cf17a0864ccf150984ebdd28bf616573772cf678246cc1bdbcbc0f","tests/metric_metadata.rs":"05c947d3decf0a3281378dbb108080a05319ad8f130af5b07f9b049b80e5f04f","tests/near-empty-c0ffee-db.safe.bin":"89afb3bb8fc94430fb0ed0fe55f85f3f8bcc8fd0fed69a9df13cc560294ec9f5","tests/never_init.rs":"51fff5618f6603bc0945d70131698d10a1c6275f43bbc22a2de5807f8a79229f","tests/no_time_to_init.rs":"2ede23df6618ff1cb5ae3b7bbf95900ad0fd92072afa2e0319bf147b4f75cefc","tests/overflowing_preinit.rs":"985e140460a100986fd051ce901b787a3a7a9747a856cd06066b740ac7d2381c","tests/persist_ping_lifetime_nopanic.rs":"18379d3ffbf4a2c8c684c04ff7a0660b86dfbbb447db2d24dfed6073cb7ddf8f","tests/schema.rs":"23b49005402b914e55a0c5c155f30c2662c609f79be78d1385ec25b3600b3547","tests/simple.rs":"15c76a1b5a336fd6abfbdebafc971f5c6a9b75107ddbca65f0031cde3e2886da","tests/test-delayed-ping-data.sh":"4a6db98b4df6b77898ace6a8b4e8b4c60d3e5c44873bbf38c62e83583e27a3ff","tests/test-enabled-pings.sh":"06656e38f63e65475006b107dd6bd179b0cbaa1fad1470de38e679e91a9315a3","tests/test-pending-gets-removed.sh":"e335f2f00fa97a61b6d94e0005fb3b9de8c8db8076111a67ca47d85392039ea9","tests/test-ping-lifetime-flush.sh":"e8f118ea2f6fd973809e38d5e828a03cfccfe0b0f497ccde5ec92d6d1380c071","tests/test-shutdown-blocking.sh":"a44d8d4bbe2ee3ede9e48121150ae7a5386025160c5cef2181ca142232c5fb27","tests/test-thread-crashing.sh":"f3cd0cc8a7b4fe82bef0fe6fbfbbe45fbad6da3afe0f82578bc5cfb2d6527ac6","tests/timing_distribution_buffered.rs":"501f7289c0c28f0ab83838c88b058999b19436d0f2b693be0787513d7b67e06d","tests/timing_distribution_single_sample.rs":"4f9498b6ef29913da0356027efe5f572c81d2f426e8538c068b54a1cfa33c1b8","tests/upload_timing.rs":"b3b9db197bc2ec41556388969a6bf289e7ef19e05b9019bc2bd98c823fcf6ea3","tests/uploader_capabilities.rs":"347f19e534a50a211ea179d6818631270d1b4ec468098e6b6abcde1e4a6a9bca"},"package":"95024f4707705270208e36983976cbac235dd7fc33c9f1cb0dee396ec1ce295d"} \ No newline at end of file diff --git a/third_party/rust/glean/Cargo.lock b/third_party/rust/glean/Cargo.lock index 728b31a6e9d5..012b87a0b217 100644 --- a/third_party/rust/glean/Cargo.lock +++ b/third_party/rust/glean/Cargo.lock @@ -135,9 +135,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.14" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" dependencies = [ "crossbeam-utils", ] @@ -242,7 +242,7 @@ dependencies = [ [[package]] name = "glean" -version = "64.0.1" +version = "64.1.1" dependencies = [ "crossbeam-channel", "env_logger", @@ -260,9 +260,9 @@ dependencies = [ [[package]] name = "glean-core" -version = "64.0.1" +version = "64.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49d1d62648ddeed8cb996373046ea45de93f1d1ff956aba054b9304bc305753" +checksum = "5ca0df94fb37669287b77e8aa300913ad1d14426d7f9e443b0ce1185349c817e" dependencies = [ "android_logger", "bincode", diff --git a/third_party/rust/glean/Cargo.toml b/third_party/rust/glean/Cargo.toml index 7b7c3937b8fe..4af49a88becf 100644 --- a/third_party/rust/glean/Cargo.toml +++ b/third_party/rust/glean/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.82" name = "glean" -version = "64.0.1" +version = "64.1.1" authors = [ "Jan-Erik Rediger ", "The Glean Team ", @@ -115,7 +115,7 @@ path = "tests/uploader_capabilities.rs" version = "0.5" [dependencies.glean-core] -version = "64.0.1" +version = "64.1.1" [dependencies.inherent] version = "1" diff --git a/third_party/rust/glean/src/lib.rs b/third_party/rust/glean/src/lib.rs index d0fd006dbf35..62ec3204014f 100644 --- a/third_party/rust/glean/src/lib.rs +++ b/third_party/rust/glean/src/lib.rs @@ -39,8 +39,8 @@ pub use glean_core::{ Datetime, DistributionData, MemoryUnit, MetricIdentifier, Rate, RecordedEvent, TimeUnit, TimerId, }, - traits, CommonMetricData, Error, ErrorType, Glean, HistogramType, LabeledMetricData, Lifetime, - PingRateLimit, RecordedExperiment, Result, + traits, AttributionMetrics, CommonMetricData, DistributionMetrics, Error, ErrorType, Glean, + HistogramType, LabeledMetricData, Lifetime, PingRateLimit, RecordedExperiment, Result, }; mod configuration; @@ -356,5 +356,31 @@ pub fn get_registered_ping_names() -> Vec { glean_core::glean_get_registered_ping_names() } +/// Updates attribution fields with new values. +/// AttributionMetrics fields with `None` values will not overwrite older values. +pub fn update_attribution(attribution: AttributionMetrics) { + glean_core::glean_update_attribution(attribution); +} + +/// **TEST-ONLY Method** +/// +/// Returns the current attribution metrics. +pub fn test_get_attribution() -> AttributionMetrics { + glean_core::glean_test_get_attribution() +} + +/// Updates distribution fields with new values. +/// DistributionMetrics fields with `None` values will not overwrite older values. +pub fn update_distribution(distribution: DistributionMetrics) { + glean_core::glean_update_distribution(distribution); +} + +/// **TEST-ONLY Method** +/// +/// Returns the current distribution metrics. +pub fn test_get_distribution() -> DistributionMetrics { + glean_core::glean_test_get_distribution() +} + #[cfg(test)] mod test; diff --git a/third_party/rust/glean/src/test.rs b/third_party/rust/glean/src/test.rs index d7e1c668c12b..72e766d68a60 100644 --- a/third_party/rust/glean/src/test.rs +++ b/third_party/rust/glean/src/test.rs @@ -1501,3 +1501,49 @@ fn pings_ride_along_builtin_pings() { let url = r.recv().unwrap(); assert!(url.contains("ride-along")); } + +#[test] +fn test_attribution_and_distribution_updates_before_glean_inits() { + let _lock = lock_test(); + let dir = tempfile::tempdir().unwrap(); + let tmpname = dir.path().to_path_buf(); + + destroy_glean(true, &tmpname); + + // No Glean, let's set and update some attribution + distribution. + let mut attribution = AttributionMetrics { + source: Some("source".into()), + medium: Some("medium".into()), + campaign: Some("campaign".into()), + term: Some("term".into()), + content: Some("content".into()), + }; + let distribution = DistributionMetrics { + name: Some("name".into()), + }; + update_attribution(attribution.clone()); + update_distribution(distribution); + + let attribution_update = AttributionMetrics { + term: Some("new term".into()), + ..Default::default() + }; + let distribution_update = DistributionMetrics { + name: Some("different name".into()), + }; + update_attribution(attribution_update); + update_distribution(distribution_update.clone()); + + test_reset_glean( + ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) + .with_server_endpoint("invalid-test-host") + .build(), + ClientInfoMetrics::unknown(), + false, + ); + + // Ensure the updated attribution + distribution are correctly stored. + attribution.term = Some("new term".into()); + assert_eq!(attribution, test_get_attribution()); + assert_eq!(distribution_update, test_get_distribution()); +} diff --git a/toolkit/components/glean/api/src/private/labeled.rs b/toolkit/components/glean/api/src/private/labeled.rs index c1b32933fd5e..662a32ce65ec 100644 --- a/toolkit/components/glean/api/src/private/labeled.rs +++ b/toolkit/components/glean/api/src/private/labeled.rs @@ -587,7 +587,7 @@ mod test { None, ); - metric.get(&"1".repeat(72)).set(true); + metric.get(&"1".repeat(112)).set(true); assert_eq!( 1, diff --git a/toolkit/components/glean/bindings/private/Labeled.h b/toolkit/components/glean/bindings/private/Labeled.h index 05e9e602abec..8602f541c95c 100644 --- a/toolkit/components/glean/bindings/private/Labeled.h +++ b/toolkit/components/glean/bindings/private/Labeled.h @@ -407,11 +407,11 @@ class Labeled { TimingDistributionMetric MaybeTruncateAndGet(const nsACString& aLabel) const { // bug 1959765 is for incorporating this behaviour into the SDK. - if (aLabel.Length() < 72) { // bug 1959696 will up this to 112. + if (aLabel.Length() < 112) { return Get(aLabel); } - nsAutoCStringN<71> truncated; // bug 1959696 will up this to 111. - truncated.Append(aLabel.BeginReading(), 68); + nsAutoCStringN<111> truncated; + truncated.Append(aLabel.BeginReading(), 108); truncated += "..."; return Get(truncated); } diff --git a/toolkit/components/glean/tests/browser/browser_labeled_gifft.js b/toolkit/components/glean/tests/browser/browser_labeled_gifft.js index a6b5761c9805..bf6d45ed8690 100644 --- a/toolkit/components/glean/tests/browser/browser_labeled_gifft.js +++ b/toolkit/components/glean/tests/browser/browser_labeled_gifft.js @@ -30,7 +30,7 @@ add_task(async () => { undefined, Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue() ); - Glean.testOnlyIpc.aLabeledCounter["1".repeat(72)].add(3); + Glean.testOnlyIpc.aLabeledCounter["1".repeat(112)].add(3); Assert.throws( () => Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue(), /DataError/, @@ -44,7 +44,6 @@ add_task(async () => { { a_label: 1, another_label: 2, - ["1".repeat(72)]: 3, }, value ); diff --git a/toolkit/components/glean/tests/gtest/TestFog.cpp b/toolkit/components/glean/tests/gtest/TestFog.cpp index 62b95acf63c9..a1be564e77d9 100644 --- a/toolkit/components/glean/tests/gtest/TestFog.cpp +++ b/toolkit/components/glean/tests/gtest/TestFog.cpp @@ -609,9 +609,8 @@ TEST_F(FOGFixture, TestLabeledTimingDistWorks) { } TEST_F(FOGFixture, TestLabeledTimingDistTruncateGet) { - // Note that bug 1959696 will up this limit to 111. auto longKey = - "this is a key that is longer than the present limit of 71 characters ok?"_ns; + "this is a label that is longer than the new label limit of 111 characters introduced in bug 1959696 in April of 2025."_ns; auto sec = TimeDuration::FromMilliseconds(1); test_only::where_has_the_time_gone.MaybeTruncateAndGet(longKey) diff --git a/toolkit/components/glean/tests/xpcshell/test_GIFFT.js b/toolkit/components/glean/tests/xpcshell/test_GIFFT.js index cd12c2cc21e2..004d83a5fdca 100644 --- a/toolkit/components/glean/tests/xpcshell/test_GIFFT.js +++ b/toolkit/components/glean/tests/xpcshell/test_GIFFT.js @@ -318,7 +318,7 @@ add_task(function test_gifft_labeled_counter() { undefined, Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue() ); - Glean.testOnlyIpc.aLabeledCounter["1".repeat(72)].add(3); + Glean.testOnlyIpc.aLabeledCounter["1".repeat(112)].add(3); Assert.throws( () => Glean.testOnlyIpc.aLabeledCounter.__other__.testGetValue(), /DataError/, @@ -332,7 +332,6 @@ add_task(function test_gifft_labeled_counter() { { a_label: 4, another_label: 2, - ["1".repeat(72)]: 3, }, value ); @@ -497,7 +496,7 @@ add_task(async function test_gifft_labeled_boolean() { undefined, Glean.testOnly.mirrorsForLabeledBools.__other__.testGetValue() ); - Glean.testOnly.mirrorsForLabeledBools["1".repeat(72)].set(true); + Glean.testOnly.mirrorsForLabeledBools["1".repeat(112)].set(true); Assert.throws( () => Glean.testOnly.mirrorsForLabeledBools.__other__.testGetValue(), /DataError/, @@ -510,7 +509,6 @@ add_task(async function test_gifft_labeled_boolean() { { a_label: true, another_label: false, - ["1".repeat(72)]: true, }, value ); @@ -809,7 +807,7 @@ add_task(async function test_gifft_labeled_quantity() { Assert.equal(1, Glean.testOnly.buttonJars.whoseGot.testGetValue()); // What about invalid/__other__? Assert.equal(undefined, Glean.testOnly.buttonJars.__other__.testGetValue()); - Glean.testOnly.buttonJars["1".repeat(72)].set(9000); + Glean.testOnly.buttonJars["1".repeat(112)].set(9000); Assert.throws( () => Glean.testOnly.buttonJars.__other__.testGetValue(), /DataError/, @@ -823,7 +821,6 @@ add_task(async function test_gifft_labeled_quantity() { { pants: 42, whoseGot: 1, - ["1".repeat(72)]: 9000, }, value ); diff --git a/toolkit/components/glean/tests/xpcshell/test_GIFFTIPC.js b/toolkit/components/glean/tests/xpcshell/test_GIFFTIPC.js index f6621ac1cda0..dff784fc2b55 100644 --- a/toolkit/components/glean/tests/xpcshell/test_GIFFTIPC.js +++ b/toolkit/components/glean/tests/xpcshell/test_GIFFTIPC.js @@ -103,7 +103,9 @@ add_task({ skip_if: () => runningInParent }, async function run_child_stuff() { // Has to be different from aLabeledCounter so the error we record doesn't // get in the way. - Glean.testOnlyIpc.anotherLabeledCounter["1".repeat(72)].add(INVALID_COUNTERS); + Glean.testOnlyIpc.anotherLabeledCounter["1".repeat(112)].add( + INVALID_COUNTERS + ); Glean.testOnlyIpc.aLabeledCounterForHgram.true.add(1); Glean.testOnlyIpc.aLabeledCounterForHgram.false.add(1); @@ -277,12 +279,7 @@ add_task( "telemetry.test.mirror_for_labeled_counter", "content" ); - Assert.deepEqual( - { - ["1".repeat(72)]: INVALID_COUNTERS, - }, - value - ); + Assert.deepEqual(undefined, value); const boolHgramCounters = Glean.testOnlyIpc.aLabeledCounterForHgram; Assert.equal(boolHgramCounters.true.testGetValue(), 1); diff --git a/toolkit/components/glean/tests/xpcshell/test_Glean.js b/toolkit/components/glean/tests/xpcshell/test_Glean.js index 927939839267..cc05538a3411 100644 --- a/toolkit/components/glean/tests/xpcshell/test_Glean.js +++ b/toolkit/components/glean/tests/xpcshell/test_Glean.js @@ -321,7 +321,7 @@ add_task(async function test_fog_labels_conform() { "wednesday", Glean.testOnly.mabelsLabelMaker.camelCase.testGetValue() ); - const veryLong = "1".repeat(72); + const veryLong = "1".repeat(112); Glean.testOnly.mabelsLabelMaker[veryLong].set("seventy-two"); Assert.throws( () => Glean.testOnly.mabelsLabelMaker[veryLong].testGetValue(), @@ -358,7 +358,7 @@ add_task(async function test_fog_labeled_boolean_works() { undefined, Glean.testOnly.mabelsLikeBalloons.__other__.testGetValue() ); - Glean.testOnly.mabelsLikeBalloons["1".repeat(72)].set(true); + Glean.testOnly.mabelsLikeBalloons["1".repeat(112)].set(true); Assert.throws( () => Glean.testOnly.mabelsLikeBalloons.__other__.testGetValue(), /DataError/, @@ -387,7 +387,7 @@ add_task(async function test_fog_labeled_counter_works() { undefined, Glean.testOnly.mabelsKitchenCounters.__other__.testGetValue() ); - Glean.testOnly.mabelsKitchenCounters["1".repeat(72)].add(1); + Glean.testOnly.mabelsKitchenCounters["1".repeat(112)].add(1); Assert.throws( () => Glean.testOnly.mabelsKitchenCounters.__other__.testGetValue(), /DataError/, @@ -416,7 +416,7 @@ add_task(async function test_fog_labeled_string_works() { undefined, Glean.testOnly.mabelsBalloonStrings.__other__.testGetValue() ); - Glean.testOnly.mabelsBalloonStrings["1".repeat(72)].set("valid"); + Glean.testOnly.mabelsBalloonStrings["1".repeat(112)].set("valid"); Assert.throws( () => Glean.testOnly.mabelsBalloonStrings.__other__.testGetValue(), /DataError/ @@ -715,7 +715,7 @@ add_task(async function test_fog_labeled_custom_distribution_works() { Glean.testOnly.mabelsCustomLabelLengths.__other__.testGetValue() ); Glean.testOnly.mabelsCustomLabelLengths[ - "1".repeat(72) + "1".repeat(112) ].accumulateSingleSample(3); Assert.throws( () => Glean.testOnly.mabelsCustomLabelLengths.__other__.testGetValue(), @@ -786,7 +786,7 @@ add_task(async function test_fog_labeled_quantity_works() { Assert.equal(0, Glean.testOnly.buttonJars.curling.testGetValue()); // What about invalid/__other__? Assert.equal(undefined, Glean.testOnly.buttonJars.__other__.testGetValue()); - Glean.testOnly.buttonJars["1".repeat(72)].set(0); + Glean.testOnly.buttonJars["1".repeat(112)].set(0); Assert.throws( () => Glean.testOnly.buttonJars.__other__.testGetValue(), /DataError/, diff --git a/toolkit/components/glean/tests/xpcshell/test_GleanIPC.js b/toolkit/components/glean/tests/xpcshell/test_GleanIPC.js index 7090d2027f73..691ef017e613 100644 --- a/toolkit/components/glean/tests/xpcshell/test_GleanIPC.js +++ b/toolkit/components/glean/tests/xpcshell/test_GleanIPC.js @@ -72,7 +72,7 @@ add_task({ skip_if: () => runningInParent }, async function run_child_stuff() { COUNTERS_WITH_JUNK_ON_THEM ); - Glean.testOnly.mabelsBathroomCounters["1".repeat(72)].add(INVALID_COUNTERS); + Glean.testOnly.mabelsBathroomCounters["1".repeat(112)].add(INVALID_COUNTERS); Glean.testOnlyIpc.irate.addToNumerator(44); Glean.testOnlyIpc.irate.addToDenominator(14); diff --git a/toolkit/components/glean/tests/xpcshell/test_JOG.js b/toolkit/components/glean/tests/xpcshell/test_JOG.js index 610bb7bab9e1..48fc04b7d1c9 100644 --- a/toolkit/components/glean/tests/xpcshell/test_JOG.js +++ b/toolkit/components/glean/tests/xpcshell/test_JOG.js @@ -379,7 +379,7 @@ add_task(async function test_jog_labeled_boolean_works() { Assert.equal(undefined, Glean.jogCat.jogLabeledBool.__other__.testGetValue()); Glean.jogCat.jogLabeledBool.NowValidLabel.set(true); Assert.ok(Glean.jogCat.jogLabeledBool.NowValidLabel.testGetValue()); - Glean.jogCat.jogLabeledBool["1".repeat(72)].set(true); + Glean.jogCat.jogLabeledBool["1".repeat(112)].set(true); Assert.throws( () => Glean.jogCat.jogLabeledBool.__other__.testGetValue(), /DataError/, @@ -448,7 +448,7 @@ add_task(async function test_jog_labeled_counter_works() { undefined, Glean.jogCat.jogLabeledCounter.__other__.testGetValue() ); - Glean.jogCat.jogLabeledCounter["1".repeat(72)].add(1); + Glean.jogCat.jogLabeledCounter["1".repeat(112)].add(1); Assert.throws( () => Glean.jogCat.jogLabeledCounter.__other__.testGetValue(), /DataError/, @@ -486,7 +486,7 @@ add_task(async function test_jog_labeled_counter_with_static_labels_works() { undefined, Glean.jogCat.jogLabeledCounterWithLabels.__other__.testGetValue() ); - Glean.jogCat.jogLabeledCounterWithLabels["1".repeat(72)].add(1); + Glean.jogCat.jogLabeledCounterWithLabels["1".repeat(112)].add(1); // TODO:(bug 1766515) - This should throw. /*Assert.throws( () => Glean.jogCat.jogLabeledCounterWithLabels.__other__.testGetValue(), @@ -522,7 +522,7 @@ add_task(async function test_jog_labeled_string_works() { undefined, Glean.jogCat.jogLabeledString.__other__.testGetValue() ); - Glean.jogCat.jogLabeledString["1".repeat(72)].set("valid"); + Glean.jogCat.jogLabeledString["1".repeat(112)].set("valid"); Assert.throws( () => Glean.jogCat.jogLabeledString.__other__.testGetValue(), /DataError/ @@ -559,7 +559,7 @@ add_task(async function test_jog_labeled_string_with_labels_works() { undefined, Glean.jogCat.jogLabeledStringWithLabels.__other__.testGetValue() ); - Glean.jogCat.jogLabeledStringWithLabels["1".repeat(72)].set("valid"); + Glean.jogCat.jogLabeledStringWithLabels["1".repeat(112)].set("valid"); // TODO:(bug 1766515) - This should throw. /*Assert.throws( () => Glean.jogCat.jogLabeledStringWithLabels.__other__.testGetValue(), @@ -898,7 +898,7 @@ add_task(async function test_jog_labeled_quantity_works() { 100, Glean.jogCat.jogLabeledQuantity.NowValidLabel.testGetValue() ); - Glean.jogCat.jogLabeledQuantity["1".repeat(72)].set(true); + Glean.jogCat.jogLabeledQuantity["1".repeat(112)].set(true); Assert.throws( () => Glean.jogCat.jogLabeledQuantity.__other__.testGetValue(), /DataError/, diff --git a/toolkit/components/glean/tests/xpcshell/test_JOGIPC.js b/toolkit/components/glean/tests/xpcshell/test_JOGIPC.js index f8954ac8a12a..233edad4924f 100644 --- a/toolkit/components/glean/tests/xpcshell/test_JOGIPC.js +++ b/toolkit/components/glean/tests/xpcshell/test_JOGIPC.js @@ -207,12 +207,12 @@ add_task({ skip_if: () => runningInParent }, async function run_child_stuff() { Glean.jogIpc.jogLabeledCounter.label_1.add(COUNTERS_1); Glean.jogIpc.jogLabeledCounter.label_2.add(COUNTERS_2); - Glean.jogIpc.jogLabeledCounterErr["1".repeat(72)].add(INVALID_COUNTERS); + Glean.jogIpc.jogLabeledCounterErr["1".repeat(112)].add(INVALID_COUNTERS); Glean.jogIpc.jogLabeledCounterWithLabels.label_1.add(COUNTERS_1); Glean.jogIpc.jogLabeledCounterWithLabels.label_2.add(COUNTERS_2); - Glean.jogIpc.jogLabeledCounterWithLabelsErr["1".repeat(72)].add( + Glean.jogIpc.jogLabeledCounterWithLabelsErr["1".repeat(112)].add( INVALID_COUNTERS );