From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- third_party/rust/glean-core/.cargo-checksum.json | 2 +- third_party/rust/glean-core/Cargo.toml | 4 +- .../rust/glean-core/src/common_metric_data.rs | 5 +- third_party/rust/glean-core/src/core/mod.rs | 29 +++-- third_party/rust/glean-core/src/database/mod.rs | 65 ++++++++++++ third_party/rust/glean-core/src/glean.udl | 22 +++- third_party/rust/glean-core/src/internal_pings.rs | 17 +-- third_party/rust/glean-core/src/lib.rs | 42 ++++++-- third_party/rust/glean-core/src/lib_unit_tests.rs | 118 ++++++++++++++++----- .../src/metrics/metrics_enabled_config.rs | 46 -------- third_party/rust/glean-core/src/metrics/mod.rs | 21 ++-- third_party/rust/glean-core/src/metrics/object.rs | 29 +++++ third_party/rust/glean-core/src/metrics/ping.rs | 74 ++++++++++--- .../src/metrics/remote_settings_config.rs | 52 +++++++++ third_party/rust/glean-core/src/ping/mod.rs | 3 + .../rust/glean-core/src/upload/directory.rs | 6 +- third_party/rust/glean-core/src/upload/mod.rs | 24 +++++ third_party/rust/glean-core/tests/event.rs | 4 + third_party/rust/glean-core/tests/ping.rs | 46 ++++++-- third_party/rust/glean-core/tests/ping_maker.rs | 23 ++-- 20 files changed, 479 insertions(+), 153 deletions(-) delete mode 100644 third_party/rust/glean-core/src/metrics/metrics_enabled_config.rs create mode 100644 third_party/rust/glean-core/src/metrics/remote_settings_config.rs (limited to 'third_party/rust/glean-core') diff --git a/third_party/rust/glean-core/.cargo-checksum.json b/third_party/rust/glean-core/.cargo-checksum.json index 663b3141c3..e9033c86e8 100644 --- a/third_party/rust/glean-core/.cargo-checksum.json +++ b/third_party/rust/glean-core/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"c590a29d01f2ccad65fdbed80578177ae3c02522d6c6c60eef9644d71f04a0e3","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"026495898699b54608eb4ec16074ffafc57920d80ccb59961c501a1ea28c9985","build.rs":"4857bea99c6b8c08db8818efa9d3738716f52d3acb68159323957ae52892a3eb","src/common_metric_data.rs":"864990a1e5770d5d5fdebcd2c36b58c3442334030fb60f53811395b56baac94b","src/core/mod.rs":"9880520967e9da0b475d280c17cd70debf9a1d15912018cbba775e5fde0ff588","src/core_metrics.rs":"a877e42e0f8b932adb52a5681ad76fd977808cb48c7eeb29b1e4bbe804f1ea96","src/coverage.rs":"49613fd310bd24d779472720975fbe6c97ec370a95eb55f10afa43f67539c942","src/database/mod.rs":"b3684bb6a11e0aa2a51306a53feddbc89bc21879d4930d5e9995869950af3413","src/debug.rs":"d0dfc0932a0953bbbe029f723bf2613c8d691f34b017e858030c46b02a46a17d","src/dispatcher/global.rs":"f69cd81a90a37c306d4e0ce8177ea5a3ae2ffda5b431ae46b9a22c9e38891271","src/dispatcher/mod.rs":"391310269947452d7e0de24c848c183110c60149d75e345ba6d5d146f222dace","src/error.rs":"b93c7d3e243b21bb9eafc95f17860aba1a942b2f2b0a7f43307690f05fece516","src/error_recording.rs":"1aba34e9d3c741755055f5b76415114b25b146b0aa90049c3457cfe12066deda","src/event_database/mod.rs":"78633293e1f3c9e9d51705615a7a4b603d7f85567bfdc2b0bad35ccda6a12d44","src/fd_logger.rs":"0c9def6fa53db1a2ab93c85795f8a7df57797bcfd3978146923e151752e291a6","src/glean.udl":"0fcf72a8e3304d98e896dd3dfd9787208776c2b21b59f1c241029978ee37a925","src/glean_metrics.rs":"9414fb1453d19f6832df33e4c6ef7383d62203e47026bf5bc9552b083101ddd1","src/histogram/exponential.rs":"58bb1770bae45770d92995515d328eb50a7e78726224f779446ae7d1632a6a3e","src/histogram/functional.rs":"1a63a305b48bcef7bc38136b40d916df4bb8f098dc602514ada54a9b091f6951","src/histogram/linear.rs":"4342a1733175d7f97b2b41adb18100537c206100c9fccb5bd13bd782c9cb3c9a","src/histogram/mod.rs":"bbb9535a633b5a85b6b11c6e4eed3314ab797950355a9bb8ccf3a22000f1e093","src/internal_metrics.rs":"263779535963a804c8c7fa6f8e284ac8ec7f415ceeadbb6a8f913a1e7073ae18","src/internal_pings.rs":"0e3b8ce673cf92bd085fd4f07aa43876c97472dbd921a2d0dc0f10c9fe6b1c6b","src/lib.rs":"fb50a72a7221358c5daa1a8c0e59c92d5d358adc10b1ba9b831d2f07c07d90e2","src/lib_unit_tests.rs":"76d1997f7608b735cc4e905cfa94f79dd71a4a2ed1eccaa89d3d72ccd8d348e2","src/metrics/boolean.rs":"2b9ef57e3582c9bd8b2cca8ab94c962a4871ecc00e837b913c9b0349ba9dff08","src/metrics/counter.rs":"b4a52a8167fb0edd6354f952525e59f3eadb4261de3483374f03c94449d30b92","src/metrics/custom_distribution.rs":"e1f2edfefb67da4bf369bab3d3047f4ff6539a1fea0eee81c78d96626e5b4bb0","src/metrics/datetime.rs":"e4405762fc71718299fa1b208e3d5fda654bd1b82fe908c884c284e3530de2ec","src/metrics/denominator.rs":"95e8442f90bad97f80fc74b146782f215344b52c5f3825ae0a8baffdc001a714","src/metrics/event.rs":"cd52e200d313e2e6f31707419d4a7fe1cab34916ee145f8136440d6da34aaad4","src/metrics/experiment.rs":"5f9278cca4e133eb8df33bbfe36d1fe0ef3eade8c09f1b46db3c4d0790515412","src/metrics/labeled.rs":"8d6e76a07064d132cd617c7901f2bc11ff6ba31e3483ba3b96354a4a3736b58d","src/metrics/memory_distribution.rs":"7f6ca51acb470df277ff14427c0e7bb07d921c0a0087d0cc56aebe038d198ccc","src/metrics/memory_unit.rs":"ee32e020cb303dd631457374048a3ed53a2e7cbacc29c54d17d836fb15507538","src/metrics/metrics_enabled_config.rs":"c45f2cd48b36f8706e0e1d402d6fc375f5bab50f7d0840e0fbbbeacb6f2732af","src/metrics/mod.rs":"8f8958b8cedfe01df6c97ec26b63f14fd7516f9de7ba62984062db96b5708720","src/metrics/numerator.rs":"937dfd583b797ac798a525cedca95c5a36262356760a89670d8113983c263154","src/metrics/object.rs":"89ce5190ed681b26b74a06a4ecaf9f96c36f96be1276f1fdb40f4406648e08c1","src/metrics/ping.rs":"86dc577422075c759edb998acbd890c239569d72b30a994e7777d6d0f7676c5a","src/metrics/quantity.rs":"aa13a8f8cf8e5e0281668fbbafc2998411df2a499479423558fd91b9bd7f8702","src/metrics/rate.rs":"603cc45c149c7a27c93b6a80146bf43f8ce70d9655f905bb5be6bc2c15bcb22b","src/metrics/recorded_experiment.rs":"33958abee79d8b55dec4cb5d20742640423713010f76314075cefde18b5c118a","src/metrics/string.rs":"0906b4d5ec1ec10b7a56fd6eb39dc30500531658df2c8bc3f55c9579e15c88db","src/metrics/string_list.rs":"ed53a095184c3e8224d0511809b5d7601ba3166505a39b0570f24ebeb0a5b97c","src/metrics/text.rs":"757f6919124d74e0512faa5bb9751a729b6bbc63ebe4d16ca81e9087f5595eaf","src/metrics/time_unit.rs":"4704703e19e799933aec3f39e3d3a125058756d7c7ba04f8729885c7843df447","src/metrics/timespan.rs":"1ad5233c7522cab70b4c095fb24cace66ace9741731f97bc001ede071f10d1ef","src/metrics/timing_distribution.rs":"261f971d012e80e93180caea69da549498597d47771264c9bb0667a9573f47ed","src/metrics/url.rs":"589ae1f8047367ad8c19b57a48ca8130d5f36cf3ce5954124150f0eb89c620ea","src/metrics/uuid.rs":"cacffd95ab30ed327ec2fa5feaf1359e667706746401f1e2c1195ad9553c4b54","src/ping/mod.rs":"fcadd52d2d536c9ace01f8a3812c3fb3c39b8094915db1b3656839fb87f771b5","src/scheduler.rs":"129863e31205404a3d1708627a62583324c347d143f976216f769893ec541ea0","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":"d14b69d0946848c1f92cc8977cbc3fc9338ff1b53b7acc31ea0fe2f1122beecb","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":"00ebdef647a7a208c01d13ba7b3996750e36de98d1f63859b609c80c8df25b6f","src/traits/url.rs":"c27f7add23214ff051078b65b88120b620560d2841a1056c7214d5237e86b9e4","src/traits/uuid.rs":"81322e71c7e847bacaf827a2cd58f6193bdc208355524207f7f38db039da6aa8","src/upload/directory.rs":"e42c62f27ace5c6504cc7703a4c1d9ffd0e6ac7c4fba7d7dee231430fb67f8f8","src/upload/mod.rs":"6151a6d3b4fccb3df7ef03207e2f77bf34dbf04b3b705e2af55dd02a731f99f8","src/upload/policy.rs":"c250957a37783e74af8002cd80ba06ef9780a389fb0f61b8b665b79688f0a360","src/upload/request.rs":"5891364d4254aafdb43751f476b0b908b681544793ac98802fe103de321ec326","src/upload/result.rs":"7efbbe50e8d36beb3f23e7bfd172d22e1c003472d2dd8055b06f6050c36437c5","src/util.rs":"ee7500434d9758a320dd410f18d7e18da956591e19d2555db87eef9623e4b916","tests/boolean.rs":"76d6014ff108cb6514d9bceb1b2b14749a55b09921f4595a5e30f1bd3546e9f0","tests/common/mod.rs":"c5bf5a9f3660ae1a1c1dbb659ab6be60438c58bc7c459f2f96dca467d05d4ab3","tests/counter.rs":"3663a3f5ec5c0bd2b758a9920cd20cc619a12566b445e4421ec7c98232bf5a32","tests/custom_distribution.rs":"41c593a0b4561e21f29d1a5b948de964a866253c58ca76ffefebe370fca150e0","tests/datetime.rs":"ec3c9760e70bb2cbc61ab23281c891bc1ec493c5c545466c29fd13e4f05c2c96","tests/event.rs":"0fbec0e8929c99603b79c62a1f57f8cabe614451fdafb6eb9d47f22116303245","tests/labeled.rs":"e9ea6dba17059d68114efce0c23373be9ceed922bf5e638a2158a6422c75a1c1","tests/memory_distribution.rs":"a5a7aa955e60823ea29a6f4bc96c61e41f1e41f08958aa4854668cf8fe04cde6","tests/object.rs":"8c35676e04f6ccf54a28764700915e753fc0355bfa5d7804d72caba66fd564cd","tests/ping.rs":"eb9f6be1aba21acc5dc670622bf622976718a706df1cc2095efa56a8e8b3fe1a","tests/ping_maker.rs":"7ad1f76a1eda2dabf0422fff74d9c2c1a39b9d1d315a4dbe6057dff44efcfae0","tests/quantity.rs":"55e7dca346fd1d27f0974b78ca3fb12427cb5da2ee637afc08a54f360f947361","tests/rate.rs":"1de571b9f0ee9a9006cbc8a31f91352d3ff1190b50840f0f668b470a7cd2a3a5","tests/storage.rs":"f0c8312bd789d7bda502cd45f35fef6b8591652bd194d07da4d81935ebe69b48","tests/string.rs":"7ece988a4b8efe6932ccb90bfe2f3c8aaea983777e99d7de6028bf6a29459ee6","tests/string_list.rs":"77188a2b90663c3f8dac5da89a6cb6b1d16a9f8c66ccd032d02966dfd14a3486","tests/text.rs":"1d43f6b90a43124311cacf0a6ee16f9e1e9263bcd11fee8b996d6efd81633638","tests/timespan.rs":"d50d75c7d75da3a878d67331cb0df8ae5e6a099ffab474361f71a408e02528d7","tests/timing_distribution.rs":"20860a7baccdcee6aed40c9cc8202b94f3b2e61164fbaf8f2af96b0f404a895a","tests/uuid.rs":"052ad26a6927c56272219340211cf4a059d200f14287b482fe8621d7bce3cc54","uniffi.toml":"6ddc98b686b0925a81abd9d1c769e5c98ac29771b210a1c535931a46dec9a8e3"},"package":"ea06a592b1395e0a16a5f4d6872f009ca7c98acc5127a8119088f1b435b5aaae"} \ No newline at end of file +{"files":{"Cargo.toml":"76031a9e743406219c98ef0c831e573b693c0db01ae7702a80917ce4816424df","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"026495898699b54608eb4ec16074ffafc57920d80ccb59961c501a1ea28c9985","build.rs":"4857bea99c6b8c08db8818efa9d3738716f52d3acb68159323957ae52892a3eb","src/common_metric_data.rs":"02dd1628fed6587621c089952dd0cb80bed3c352cdacfb33be7e218ad1d847e9","src/core/mod.rs":"a6a919646309d94b6d8b729cd717d5b6f2925095b88f5d11b4222cfd38998b40","src/core_metrics.rs":"a877e42e0f8b932adb52a5681ad76fd977808cb48c7eeb29b1e4bbe804f1ea96","src/coverage.rs":"49613fd310bd24d779472720975fbe6c97ec370a95eb55f10afa43f67539c942","src/database/mod.rs":"fb3caafb1e9dd08bd2559e56c5e0713d742795599d604a01b58b92db207e2842","src/debug.rs":"d0dfc0932a0953bbbe029f723bf2613c8d691f34b017e858030c46b02a46a17d","src/dispatcher/global.rs":"f69cd81a90a37c306d4e0ce8177ea5a3ae2ffda5b431ae46b9a22c9e38891271","src/dispatcher/mod.rs":"391310269947452d7e0de24c848c183110c60149d75e345ba6d5d146f222dace","src/error.rs":"b93c7d3e243b21bb9eafc95f17860aba1a942b2f2b0a7f43307690f05fece516","src/error_recording.rs":"1aba34e9d3c741755055f5b76415114b25b146b0aa90049c3457cfe12066deda","src/event_database/mod.rs":"78633293e1f3c9e9d51705615a7a4b603d7f85567bfdc2b0bad35ccda6a12d44","src/fd_logger.rs":"0c9def6fa53db1a2ab93c85795f8a7df57797bcfd3978146923e151752e291a6","src/glean.udl":"ebc09d8b03eed846a79c9ddb6bc81dc57ca9c28586886805bbc0fb2d64a8e225","src/glean_metrics.rs":"9414fb1453d19f6832df33e4c6ef7383d62203e47026bf5bc9552b083101ddd1","src/histogram/exponential.rs":"58bb1770bae45770d92995515d328eb50a7e78726224f779446ae7d1632a6a3e","src/histogram/functional.rs":"1a63a305b48bcef7bc38136b40d916df4bb8f098dc602514ada54a9b091f6951","src/histogram/linear.rs":"4342a1733175d7f97b2b41adb18100537c206100c9fccb5bd13bd782c9cb3c9a","src/histogram/mod.rs":"bbb9535a633b5a85b6b11c6e4eed3314ab797950355a9bb8ccf3a22000f1e093","src/internal_metrics.rs":"263779535963a804c8c7fa6f8e284ac8ec7f415ceeadbb6a8f913a1e7073ae18","src/internal_pings.rs":"c54339cb2530eec7717a3f6dd81ce98adf5da5d615bcf0a071fd90f415016866","src/lib.rs":"0fab5462a6b2a86244cfd7b3cdf99996b4b410f34ee9f0f8e16758fafdcfa389","src/lib_unit_tests.rs":"6180628e46d3dbcd8dbd5e7f3cdbc12a3987c0b3a9d6638ab1341f3f3d666db7","src/metrics/boolean.rs":"2b9ef57e3582c9bd8b2cca8ab94c962a4871ecc00e837b913c9b0349ba9dff08","src/metrics/counter.rs":"b4a52a8167fb0edd6354f952525e59f3eadb4261de3483374f03c94449d30b92","src/metrics/custom_distribution.rs":"e1f2edfefb67da4bf369bab3d3047f4ff6539a1fea0eee81c78d96626e5b4bb0","src/metrics/datetime.rs":"e4405762fc71718299fa1b208e3d5fda654bd1b82fe908c884c284e3530de2ec","src/metrics/denominator.rs":"95e8442f90bad97f80fc74b146782f215344b52c5f3825ae0a8baffdc001a714","src/metrics/event.rs":"cd52e200d313e2e6f31707419d4a7fe1cab34916ee145f8136440d6da34aaad4","src/metrics/experiment.rs":"5f9278cca4e133eb8df33bbfe36d1fe0ef3eade8c09f1b46db3c4d0790515412","src/metrics/labeled.rs":"8d6e76a07064d132cd617c7901f2bc11ff6ba31e3483ba3b96354a4a3736b58d","src/metrics/memory_distribution.rs":"7f6ca51acb470df277ff14427c0e7bb07d921c0a0087d0cc56aebe038d198ccc","src/metrics/memory_unit.rs":"ee32e020cb303dd631457374048a3ed53a2e7cbacc29c54d17d836fb15507538","src/metrics/mod.rs":"cc99e7b27a5cecc974475790e1bd4cce86813b881e3c1d858aa446c9fe5183f8","src/metrics/numerator.rs":"937dfd583b797ac798a525cedca95c5a36262356760a89670d8113983c263154","src/metrics/object.rs":"2a1f1cc31973b576e55ba464b35c41b9420f62471eebba51273bca6856459538","src/metrics/ping.rs":"ac4cdda5cc94ddf2a2206188abcfa3517de4500ba3eadd976758fb9cffcb3624","src/metrics/quantity.rs":"aa13a8f8cf8e5e0281668fbbafc2998411df2a499479423558fd91b9bd7f8702","src/metrics/rate.rs":"603cc45c149c7a27c93b6a80146bf43f8ce70d9655f905bb5be6bc2c15bcb22b","src/metrics/recorded_experiment.rs":"33958abee79d8b55dec4cb5d20742640423713010f76314075cefde18b5c118a","src/metrics/remote_settings_config.rs":"3565514a0444cb322e1f7944417167233d727a195c837bd7aee5eae88d5f0766","src/metrics/string.rs":"0906b4d5ec1ec10b7a56fd6eb39dc30500531658df2c8bc3f55c9579e15c88db","src/metrics/string_list.rs":"ed53a095184c3e8224d0511809b5d7601ba3166505a39b0570f24ebeb0a5b97c","src/metrics/text.rs":"757f6919124d74e0512faa5bb9751a729b6bbc63ebe4d16ca81e9087f5595eaf","src/metrics/time_unit.rs":"4704703e19e799933aec3f39e3d3a125058756d7c7ba04f8729885c7843df447","src/metrics/timespan.rs":"1ad5233c7522cab70b4c095fb24cace66ace9741731f97bc001ede071f10d1ef","src/metrics/timing_distribution.rs":"261f971d012e80e93180caea69da549498597d47771264c9bb0667a9573f47ed","src/metrics/url.rs":"589ae1f8047367ad8c19b57a48ca8130d5f36cf3ce5954124150f0eb89c620ea","src/metrics/uuid.rs":"cacffd95ab30ed327ec2fa5feaf1359e667706746401f1e2c1195ad9553c4b54","src/ping/mod.rs":"4c427ee29a7555c8577bd97fc4b85de4158f10062f73a5ee16b2a5d335b838b9","src/scheduler.rs":"129863e31205404a3d1708627a62583324c347d143f976216f769893ec541ea0","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":"d14b69d0946848c1f92cc8977cbc3fc9338ff1b53b7acc31ea0fe2f1122beecb","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":"00ebdef647a7a208c01d13ba7b3996750e36de98d1f63859b609c80c8df25b6f","src/traits/url.rs":"c27f7add23214ff051078b65b88120b620560d2841a1056c7214d5237e86b9e4","src/traits/uuid.rs":"81322e71c7e847bacaf827a2cd58f6193bdc208355524207f7f38db039da6aa8","src/upload/directory.rs":"5545042c1d1f37ebb08445b88c0fa8b97aad145e81e34051fad3da2a94b1b52d","src/upload/mod.rs":"7b65a31ed8b12c4a7e708edb9bbf48ab6a4c99422b4bb1f50891cde07f5e6a3c","src/upload/policy.rs":"c250957a37783e74af8002cd80ba06ef9780a389fb0f61b8b665b79688f0a360","src/upload/request.rs":"5891364d4254aafdb43751f476b0b908b681544793ac98802fe103de321ec326","src/upload/result.rs":"7efbbe50e8d36beb3f23e7bfd172d22e1c003472d2dd8055b06f6050c36437c5","src/util.rs":"ee7500434d9758a320dd410f18d7e18da956591e19d2555db87eef9623e4b916","tests/boolean.rs":"76d6014ff108cb6514d9bceb1b2b14749a55b09921f4595a5e30f1bd3546e9f0","tests/common/mod.rs":"c5bf5a9f3660ae1a1c1dbb659ab6be60438c58bc7c459f2f96dca467d05d4ab3","tests/counter.rs":"3663a3f5ec5c0bd2b758a9920cd20cc619a12566b445e4421ec7c98232bf5a32","tests/custom_distribution.rs":"41c593a0b4561e21f29d1a5b948de964a866253c58ca76ffefebe370fca150e0","tests/datetime.rs":"ec3c9760e70bb2cbc61ab23281c891bc1ec493c5c545466c29fd13e4f05c2c96","tests/event.rs":"3cfe41e67d300683f690a672cc82ca2f29658c870ba78b824f9e1e3d3556a2b5","tests/labeled.rs":"e9ea6dba17059d68114efce0c23373be9ceed922bf5e638a2158a6422c75a1c1","tests/memory_distribution.rs":"a5a7aa955e60823ea29a6f4bc96c61e41f1e41f08958aa4854668cf8fe04cde6","tests/object.rs":"8c35676e04f6ccf54a28764700915e753fc0355bfa5d7804d72caba66fd564cd","tests/ping.rs":"6dd56b6ca2206b687fc5e67e8c603872a5b60c5847c6ecb0c8f789fdd94b2c09","tests/ping_maker.rs":"48d25109154033ccf6783f2e9bfc30d2ec26876e0092d648c40062fb67cc9925","tests/quantity.rs":"55e7dca346fd1d27f0974b78ca3fb12427cb5da2ee637afc08a54f360f947361","tests/rate.rs":"1de571b9f0ee9a9006cbc8a31f91352d3ff1190b50840f0f668b470a7cd2a3a5","tests/storage.rs":"f0c8312bd789d7bda502cd45f35fef6b8591652bd194d07da4d81935ebe69b48","tests/string.rs":"7ece988a4b8efe6932ccb90bfe2f3c8aaea983777e99d7de6028bf6a29459ee6","tests/string_list.rs":"77188a2b90663c3f8dac5da89a6cb6b1d16a9f8c66ccd032d02966dfd14a3486","tests/text.rs":"1d43f6b90a43124311cacf0a6ee16f9e1e9263bcd11fee8b996d6efd81633638","tests/timespan.rs":"d50d75c7d75da3a878d67331cb0df8ae5e6a099ffab474361f71a408e02528d7","tests/timing_distribution.rs":"20860a7baccdcee6aed40c9cc8202b94f3b2e61164fbaf8f2af96b0f404a895a","tests/uuid.rs":"052ad26a6927c56272219340211cf4a059d200f14287b482fe8621d7bce3cc54","uniffi.toml":"6ddc98b686b0925a81abd9d1c769e5c98ac29771b210a1c535931a46dec9a8e3"},"package":"86db1cca10118079e9ae34681a6f762f6c51150971552e98f0dfec1d7a556c21"} \ 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 932b16a4a7..fba18dd4d8 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.66" name = "glean-core" -version = "59.0.0" +version = "60.0.1" authors = [ "Jan-Erik Rediger ", "The Glean Team ", @@ -35,7 +35,7 @@ license = "MPL-2.0" repository = "https://github.com/mozilla/glean" [package.metadata.glean] -glean-parser = "13.0.0" +glean-parser = "14.0.1" [dependencies.bincode] version = "1.2.1" diff --git a/third_party/rust/glean-core/src/common_metric_data.rs b/third_party/rust/glean-core/src/common_metric_data.rs index 9bda9bb462..f5058d995f 100644 --- a/third_party/rust/glean-core/src/common_metric_data.rs +++ b/third_party/rust/glean-core/src/common_metric_data.rs @@ -90,9 +90,10 @@ impl Clone for CommonMetricDataInternal { impl From for CommonMetricDataInternal { fn from(input_data: CommonMetricData) -> Self { + let disabled = input_data.disabled; Self { - inner: input_data.clone(), - disabled: AtomicU8::new(u8::from(input_data.disabled)), + inner: input_data, + disabled: AtomicU8::new(u8::from(disabled)), } } } diff --git a/third_party/rust/glean-core/src/core/mod.rs b/third_party/rust/glean-core/src/core/mod.rs index f69f0c3868..9b8cfe531b 100644 --- a/third_party/rust/glean-core/src/core/mod.rs +++ b/third_party/rust/glean-core/src/core/mod.rs @@ -16,7 +16,7 @@ use crate::event_database::EventDatabase; use crate::internal_metrics::{AdditionalMetrics, CoreMetrics, DatabaseMetrics}; use crate::internal_pings::InternalPings; use crate::metrics::{ - self, ExperimentMetric, Metric, MetricType, MetricsEnabledConfig, PingType, RecordedExperiment, + self, ExperimentMetric, Metric, MetricType, PingType, RecordedExperiment, RemoteSettingsConfig, }; use crate::ping::PingMaker; use crate::storage::{StorageManager, INTERNAL_STORAGE}; @@ -123,7 +123,7 @@ where /// enable_internal_pings: true, /// }; /// let mut glean = Glean::new(cfg).unwrap(); -/// let ping = PingType::new("sample", true, false, true, true, vec![]); +/// let ping = PingType::new("sample", true, false, true, true, true, vec![], vec![]); /// glean.register_ping_type(&ping); /// /// let call_counter: CounterMetric = CounterMetric::new(CommonMetricData { @@ -162,7 +162,7 @@ pub struct Glean { pub(crate) app_build: String, pub(crate) schedule_metrics_pings: bool, pub(crate) remote_settings_epoch: AtomicU8, - pub(crate) remote_settings_metrics_config: Arc>, + pub(crate) remote_settings_config: Arc>, pub(crate) with_timestamps: bool, } @@ -222,7 +222,7 @@ impl Glean { // Subprocess doesn't use "metrics" pings so has no need for a scheduler. schedule_metrics_pings: false, remote_settings_epoch: AtomicU8::new(0), - remote_settings_metrics_config: Arc::new(Mutex::new(MetricsEnabledConfig::new())), + remote_settings_config: Arc::new(Mutex::new(RemoteSettingsConfig::new())), with_timestamps: cfg.enable_event_timestamps, }; @@ -758,19 +758,26 @@ impl Glean { .get_value(self, None) } - /// Set configuration to override the default metric enabled/disabled state, typically from a + /// Set configuration to override the default state, typically initiated from a /// remote_settings experiment or rollout /// /// # Arguments /// - /// * `json` - The stringified JSON representation of a `MetricsEnabledConfig` object - pub fn set_metrics_enabled_config(&self, cfg: MetricsEnabledConfig) { - // Set the current MetricsEnabledConfig, keeping the lock until the epoch is + /// * `cfg` - The stringified JSON representation of a `RemoteSettingsConfig` object + pub fn apply_server_knobs_config(&self, cfg: RemoteSettingsConfig) { + // Set the current RemoteSettingsConfig, keeping the lock until the epoch is // updated to prevent against reading a "new" config but an "old" epoch - let mut metric_config = self.remote_settings_metrics_config.lock().unwrap(); + let mut remote_settings_config = self.remote_settings_config.lock().unwrap(); - // Merge the exising configuration with the supplied one - metric_config.metrics_enabled.extend(cfg.metrics_enabled); + // Merge the exising metrics configuration with the supplied one + remote_settings_config + .metrics_enabled + .extend(cfg.metrics_enabled); + + // Merge the exising ping configuration with the supplied one + remote_settings_config + .pings_enabled + .extend(cfg.pings_enabled); // Update remote_settings epoch self.remote_settings_epoch.fetch_add(1, Ordering::SeqCst); diff --git a/third_party/rust/glean-core/src/database/mod.rs b/third_party/rust/glean-core/src/database/mod.rs index 0dbf0220bc..75a068b42e 100644 --- a/third_party/rust/glean-core/src/database/mod.rs +++ b/third_party/rust/glean-core/src/database/mod.rs @@ -9,6 +9,8 @@ use std::io; use std::num::NonZeroU64; use std::path::Path; use std::str; +#[cfg(target_os = "android")] +use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::RwLock; use crate::ErrorKind; @@ -167,6 +169,13 @@ use crate::Glean; use crate::Lifetime; use crate::Result; +/// The number of writes we accept writes to the ping-lifetime in-memory map +/// before data is flushed to disk. +/// +/// Only considered if `delay_ping_lifetime_io` is set to `true`. +#[cfg(target_os = "android")] +const PING_LIFETIME_THRESHOLD: usize = 1000; + pub struct Database { /// Handle to the database environment. rkv: Rkv, @@ -184,6 +193,14 @@ pub struct Database { /// so as to persist them to disk using rkv in bulk on demand. ping_lifetime_data: Option>>, + /// A count of how many database writes have been done since the last ping-lifetime flush. + /// + /// A ping-lifetime flush is automatically done after `PING_LIFETIME_THRESHOLD` writes. + /// + /// Only relevant if `delay_ping_lifetime_io` is set to `true`, + #[cfg(target_os = "android")] + ping_lifetime_count: AtomicUsize, + /// Initial file size when opening the database. file_size: Option, @@ -263,6 +280,8 @@ impl Database { ping_store, application_store, ping_lifetime_data, + #[cfg(target_os = "android")] + ping_lifetime_count: AtomicUsize::new(0), file_size, rkv_load_state, }; @@ -528,6 +547,9 @@ impl Database { .write() .expect("Can't read ping lifetime data"); data.insert(final_key, metric.clone()); + + // flush ping lifetime + self.persist_ping_lifetime_data_if_full(&data)?; return Ok(()); } } @@ -609,6 +631,9 @@ impl Database { entry.insert(transform(Some(old_value))); } } + + // flush ping lifetime + self.persist_ping_lifetime_data_if_full(&data)?; return Ok(()); } } @@ -802,6 +827,10 @@ impl Database { .read() .expect("Can't read ping lifetime data"); + // We can reset the write-counter. Current data has been persisted. + #[cfg(target_os = "android")] + self.ping_lifetime_count.store(0, Ordering::Release); + self.write_with_store(Lifetime::Ping, |mut writer, store| { for (key, value) in data.iter() { let encoded = @@ -817,6 +846,42 @@ impl Database { } Ok(()) } + + pub fn persist_ping_lifetime_data_if_full( + &self, + data: &BTreeMap, + ) -> Result<()> { + #[cfg(target_os = "android")] + { + self.ping_lifetime_count.fetch_add(1, Ordering::Release); + + let write_count = self.ping_lifetime_count.load(Ordering::Relaxed); + if write_count < PING_LIFETIME_THRESHOLD { + return Ok(()); + } + + self.ping_lifetime_count.store(0, Ordering::Release); + let write_result = self.write_with_store(Lifetime::Ping, |mut writer, store| { + for (key, value) in data.iter() { + let encoded = + bincode::serialize(&value).expect("IMPOSSIBLE: Serializing metric failed"); + // There is no need for `get_storage_key` here because + // the key is already formatted from when it was saved + // to ping_lifetime_data. + store.put(&mut writer, key, &rkv::Value::Blob(&encoded))?; + } + writer.commit()?; + Ok(()) + }); + + return write_result; + } + #[cfg(not(target_os = "android"))] + { + _ = data; // suppress unused_variables warning. + Ok(()) + } + } } #[cfg(test)] diff --git a/third_party/rust/glean-core/src/glean.udl b/third_party/rust/glean-core/src/glean.udl index dc71fea594..b107a36f28 100644 --- a/third_party/rust/glean-core/src/glean.udl +++ b/third_party/rust/glean-core/src/glean.udl @@ -47,12 +47,14 @@ namespace glean { void glean_unregister_event_listener(string tag); // Server Knobs API - void glean_set_metrics_enabled_config(string json); + void glean_apply_server_knobs_config(string json); boolean glean_set_debug_view_tag(string tag); boolean glean_set_source_tags(sequence tags); void glean_set_log_pings(boolean value); + void glean_persist_ping_lifetime_data(); + void glean_handle_client_active(); void glean_handle_client_inactive(); @@ -292,7 +294,7 @@ enum ErrorType { }; interface PingType { - constructor(string name, boolean include_client_id, boolean send_if_empty, boolean precise_timestamps, boolean include_info_sections, sequence reason_codes); + constructor(string name, boolean include_client_id, boolean send_if_empty, boolean precise_timestamps, boolean include_info_sections, boolean enabled, sequence schedules_pings, sequence reason_codes); void submit(optional string? reason = null); }; @@ -640,3 +642,19 @@ interface TextMetric { i32 test_get_num_recorded_errors(ErrorType error); }; + +// JSON data encoded into a string +[Custom] +typedef string JsonValue; + +interface ObjectMetric { + constructor(CommonMetricData meta); + + void set_string(string object); + + JsonValue? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); + + void record_schema_error(); +}; diff --git a/third_party/rust/glean-core/src/internal_pings.rs b/third_party/rust/glean-core/src/internal_pings.rs index 1cf32feb60..4fe15352b2 100644 --- a/third_party/rust/glean-core/src/internal_pings.rs +++ b/third_party/rust/glean-core/src/internal_pings.rs @@ -21,25 +21,28 @@ pub struct InternalPings { impl InternalPings { pub fn new(enabled: bool) -> InternalPings { InternalPings { - baseline: PingType::new_internal( + baseline: PingType::new( "baseline", true, true, true, true, + enabled, + vec![], vec![ "active".to_string(), "dirty_startup".to_string(), "inactive".to_string(), ], - enabled, ), - metrics: PingType::new_internal( + metrics: PingType::new( "metrics", true, false, true, true, + enabled, + vec![], vec![ "overdue".to_string(), "reschedule".to_string(), @@ -47,20 +50,20 @@ impl InternalPings { "tomorrow".to_string(), "upgrade".to_string(), ], - enabled, ), - events: PingType::new_internal( + events: PingType::new( "events", true, false, true, true, + enabled, + vec![], vec![ "startup".to_string(), "inactive".to_string(), "max_capacity".to_string(), ], - enabled, ), deletion_request: PingType::new( "deletion-request", @@ -68,6 +71,8 @@ impl InternalPings { true, true, true, + true, // The deletion-request should not be disabled + vec![], vec!["at_init".to_string(), "set_upload_enabled".to_string()], ), } diff --git a/third_party/rust/glean-core/src/lib.rs b/third_party/rust/glean-core/src/lib.rs index af68fde264..c79fa1e226 100644 --- a/third_party/rust/glean-core/src/lib.rs +++ b/third_party/rust/glean-core/src/lib.rs @@ -28,7 +28,7 @@ use log::LevelFilter; use once_cell::sync::{Lazy, OnceCell}; use uuid::Uuid; -use metrics::MetricsEnabledConfig; +use metrics::RemoteSettingsConfig; mod common_metric_data; mod core; @@ -68,9 +68,9 @@ pub use crate::metrics::labeled::{ pub use crate::metrics::{ BooleanMetric, CounterMetric, CustomDistributionMetric, Datetime, DatetimeMetric, DenominatorMetric, DistributionData, EventMetric, MemoryDistributionMetric, MemoryUnit, - NumeratorMetric, PingType, QuantityMetric, Rate, RateMetric, RecordedEvent, RecordedExperiment, - StringListMetric, StringMetric, TextMetric, TimeUnit, TimerId, TimespanMetric, - TimingDistributionMetric, UrlMetric, UuidMetric, + NumeratorMetric, ObjectMetric, PingType, QuantityMetric, Rate, RateMetric, RecordedEvent, + RecordedExperiment, StringListMetric, StringMetric, TextMetric, TimeUnit, TimerId, + TimespanMetric, TimingDistributionMetric, UrlMetric, UuidMetric, }; pub use crate::upload::{PingRequest, PingUploadTask, UploadResult, UploadTaskAction}; @@ -693,7 +693,7 @@ pub fn shutdown() { /// Only has effect when Glean is configured with `delay_ping_lifetime_io: true`. /// If Glean hasn't been initialized this will dispatch and return Ok(()), /// otherwise it will block until the persist is done and return its Result. -pub fn persist_ping_lifetime_data() { +pub fn glean_persist_ping_lifetime_data() { // This is async, we can't get the Error back to the caller. crate::launch_with_glean(|glean| { let _ = glean.persist_ping_lifetime_data(); @@ -910,17 +910,17 @@ pub fn glean_test_get_experimentation_id() -> Option { /// Sets a remote configuration to override metrics' default enabled/disabled /// state /// -/// See [`core::Glean::set_metrics_enabled_config`]. -pub fn glean_set_metrics_enabled_config(json: String) { +/// See [`core::Glean::apply_server_knobs_config`]. +pub fn glean_apply_server_knobs_config(json: String) { // An empty config means it is not set, // so we avoid logging an error about it. if json.is_empty() { return; } - match MetricsEnabledConfig::try_from(json) { + match RemoteSettingsConfig::try_from(json) { Ok(cfg) => launch_with_glean(|glean| { - glean.set_metrics_enabled_config(cfg); + glean.apply_server_knobs_config(cfg); }), Err(e) => { log::error!("Error setting metrics feature config: {:?}", e); @@ -1125,8 +1125,14 @@ pub fn glean_test_destroy_glean(clear_stores: bool, data_path: Option) { // Only useful if Glean initialization finished successfully // and set up the storage. - let has_storage = - core::with_opt_glean(|glean| glean.storage_opt().is_some()).unwrap_or(false); + let has_storage = core::with_opt_glean(|glean| { + // We need to flush the ping lifetime data before a full shutdown. + glean + .storage_opt() + .map(|storage| storage.persist_ping_lifetime_data()) + .is_some() + }) + .unwrap_or(false); if has_storage { uploader_shutdown(); } @@ -1229,6 +1235,20 @@ mod ffi { obj.into_owned() } } + + type JsonValue = serde_json::Value; + + impl UniffiCustomTypeConverter for JsonValue { + type Builtin = String; + + fn into_custom(val: Self::Builtin) -> uniffi::Result { + Ok(serde_json::from_str(&val)?) + } + + fn from_custom(obj: Self) -> Self::Builtin { + serde_json::to_string(&obj).unwrap() + } + } } pub use ffi::*; 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 14d3b98417..b74397317f 100644 --- a/third_party/rust/glean-core/src/lib_unit_tests.rs +++ b/third_party/rust/glean-core/src/lib_unit_tests.rs @@ -890,16 +890,17 @@ fn test_set_remote_metric_configuration() { ); // 2. Set a configuration to disable the metrics - let mut metrics_enabled_config = json!( + let mut remote_settings_config = json!( { - "category.string_metric": false, - "category.labeled_string_metric": false, + "metrics_enabled": { + "category.string_metric": false, + "category.labeled_string_metric": false, + } } ) .to_string(); - glean.set_metrics_enabled_config( - MetricsEnabledConfig::try_from(metrics_enabled_config).unwrap(), - ); + glean + .apply_server_knobs_config(RemoteSettingsConfig::try_from(remote_settings_config).unwrap()); // 3. Since the metrics were disabled, setting a new value will be ignored metric.set_sync(&glean, "VALUE_AFTER_DISABLED"); @@ -921,15 +922,16 @@ fn test_set_remote_metric_configuration() { ); // 4. Set a new configuration where one metric is enabled - metrics_enabled_config = json!( + remote_settings_config = json!( { - "category.string_metric": true, + "metrics_enabled": { + "category.string_metric": true, + } } ) .to_string(); - glean.set_metrics_enabled_config( - MetricsEnabledConfig::try_from(metrics_enabled_config).unwrap(), - ); + glean + .apply_server_knobs_config(RemoteSettingsConfig::try_from(remote_settings_config).unwrap()); // 5. Since the first metric is enabled, setting a new value should work // on it but not the second metric @@ -954,15 +956,16 @@ fn test_set_remote_metric_configuration() { // 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!( + remote_settings_config = json!( { - "category.labeled_string_metric": true, + "metrics_enabled": { + "category.labeled_string_metric": true, + } } ) .to_string(); - glean.set_metrics_enabled_config( - MetricsEnabledConfig::try_from(metrics_enabled_config).unwrap(), - ); + glean + .apply_server_knobs_config(RemoteSettingsConfig::try_from(remote_settings_config).unwrap()); // 7. Now both metrics are enabled, setting a new value should work for // both metrics with the merged configurations @@ -992,15 +995,16 @@ fn test_remote_settings_epoch() { assert_eq!(0u8, current_epoch, "Current epoch must start at 0"); // 2. Set a configuration which will trigger incrementing the epoch - let metrics_enabled_config = json!( + let remote_settings_config = json!( { - "category.string_metric": false + "metrics_enabled": { + "category.string_metric": false + } } ) .to_string(); - glean.set_metrics_enabled_config( - MetricsEnabledConfig::try_from(metrics_enabled_config).unwrap(), - ); + glean + .apply_server_knobs_config(RemoteSettingsConfig::try_from(remote_settings_config).unwrap()); // 3. Ensure the epoch updated current_epoch = glean.remote_settings_epoch.load(Ordering::Acquire); @@ -1026,15 +1030,16 @@ fn test_remote_settings_epoch_updates_in_metric() { ); // 2. Set a configuration to disable the `category.string_metric` - let metrics_enabled_config = json!( + let remote_settings_config = json!( { - "category.string_metric": false + "metrics_enabled": { + "category.string_metric": false + } } ) .to_string(); - glean.set_metrics_enabled_config( - MetricsEnabledConfig::try_from(metrics_enabled_config).unwrap(), - ); + glean + .apply_server_knobs_config(RemoteSettingsConfig::try_from(remote_settings_config).unwrap()); // 3. Ensure the epoch was updated let current_epoch = glean.remote_settings_epoch.load(Ordering::Acquire); @@ -1168,7 +1173,16 @@ fn disabled_pings_are_not_submitted() { let dir = tempfile::tempdir().unwrap(); let (mut glean, _t) = new_glean(Some(dir)); - let ping = PingType::new_internal("custom-disabled", true, false, true, true, vec![], false); + let ping = PingType::new_internal( + "custom-disabled", + true, + false, + true, + true, + false, + vec![], + vec![], + ); glean.register_ping_type(&ping); // We need to store a metric as an empty ping is not stored. @@ -1203,3 +1217,53 @@ fn internal_pings_can_be_disabled() { let submitted = glean.internal_pings.baseline.submit_sync(&glean, None); assert!(!submitted); } + +#[test] +fn pings_are_controllable_from_remote_settings_config() { + let _ = env_logger::builder().is_test(true).try_init(); + + let dir = tempfile::tempdir().unwrap(); + let (mut glean, _t) = new_glean(Some(dir)); + + let disabled_ping = PingType::new( + "custom-disabled", + true, + true, + true, + true, + false, + vec![], + vec![], + ); + glean.register_ping_type(&disabled_ping); + let enabled_ping = PingType::new( + "custom-enabled", + true, + true, + true, + true, + true, + vec![], + vec![], + ); + glean.register_ping_type(&enabled_ping); + + assert!(!disabled_ping.submit_sync(&glean, None)); + assert!(enabled_ping.submit_sync(&glean, None)); + + // Now, create a configuration to switch the enabled state of the two pings + let remote_settings_config = json!( + { + "pings_enabled": { + "custom-disabled": true, + "custom-enabled": false + } + } + ) + .to_string(); + glean + .apply_server_knobs_config(RemoteSettingsConfig::try_from(remote_settings_config).unwrap()); + + assert!(disabled_ping.submit_sync(&glean, None)); + assert!(!enabled_ping.submit_sync(&glean, None)); +} diff --git a/third_party/rust/glean-core/src/metrics/metrics_enabled_config.rs b/third_party/rust/glean-core/src/metrics/metrics_enabled_config.rs deleted file mode 100644 index b36cbc150a..0000000000 --- a/third_party/rust/glean-core/src/metrics/metrics_enabled_config.rs +++ /dev/null @@ -1,46 +0,0 @@ -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at https://mozilla.org/MPL/2.0/. - -use std::collections::HashMap; - -use serde::{Deserialize, Serialize}; - -/// Represents a list of metrics and an associated boolean property -/// indicating if the metric is enabledfrom the remote-settings -/// configuration store. The expected format of this data is stringified JSON -/// in the following format: -/// ```json -/// { -/// "category.metric_name": true -/// } -/// ``` -#[derive(Serialize, Deserialize, Debug, Clone, Default)] -pub struct MetricsEnabledConfig { - /// This is a `HashMap` consisting of base_identifiers as keys - /// and bool values representing an override for the `disabled` - /// property of the metric, only inverted to reduce confusion. - /// If a particular metric has a value of `true` here, it means - /// the default of the metric will be overriden and set to the - /// enabled state. - #[serde(flatten)] - pub metrics_enabled: HashMap, -} - -impl MetricsEnabledConfig { - /// Creates a new MetricsEnabledConfig - pub fn new() -> Self { - Default::default() - } -} - -impl TryFrom for MetricsEnabledConfig { - type Error = crate::ErrorKind; - - fn try_from(json: String) -> Result { - match serde_json::from_str(json.as_str()) { - Ok(config) => Ok(config), - Err(e) => Err(crate::ErrorKind::Json(e)), - } - } -} diff --git a/third_party/rust/glean-core/src/metrics/mod.rs b/third_party/rust/glean-core/src/metrics/mod.rs index 92001efd2a..9234fff2d1 100644 --- a/third_party/rust/glean-core/src/metrics/mod.rs +++ b/third_party/rust/glean-core/src/metrics/mod.rs @@ -22,13 +22,13 @@ mod experiment; pub(crate) mod labeled; mod memory_distribution; mod memory_unit; -mod metrics_enabled_config; mod numerator; mod object; mod ping; mod quantity; mod rate; mod recorded_experiment; +mod remote_settings_config; mod string; mod string_list; mod text; @@ -72,7 +72,7 @@ pub use self::uuid::UuidMetric; pub use crate::histogram::HistogramType; pub use recorded_experiment::RecordedExperiment; -pub use self::metrics_enabled_config::MetricsEnabledConfig; +pub use self::remote_settings_config::RemoteSettingsConfig; /// A snapshot of all buckets and the accumulated sum of a distribution. // @@ -180,7 +180,7 @@ pub trait MetricType { // Technically nothing prevents multiple calls to should_record() to run in parallel, // meaning both are reading self.meta().disabled and later writing it. In between it can - // also read remote_settings_metrics_config, which also could be modified in between those 2 reads. + // also read remote_settings_config, which also could be modified in between those 2 reads. // This means we could write the wrong remote_settings_epoch | current_disabled value. All in all // at worst we would see that metric enabled/disabled wrongly once. // But since everything is tunneled through the dispatcher, this should never ever happen. @@ -200,11 +200,7 @@ pub trait MetricType { } // The epoch's didn't match so we need to look up the disabled flag // by the base_identifier from the in-memory HashMap - let metrics_enabled = &glean - .remote_settings_metrics_config - .lock() - .unwrap() - .metrics_enabled; + let remote_settings_config = &glean.remote_settings_config.lock().unwrap(); // Get the value from the remote configuration if it is there, otherwise return the default value. let current_disabled = { let base_id = self.meta().base_identifier(); @@ -215,8 +211,13 @@ pub trait MetricType { // NOTE: The `!` preceding the `*is_enabled` is important for inverting the logic since the // underlying property in the metrics.yaml is `disabled` and the outward API is treating it as // if it were `enabled` to make it easier to understand. - if let Some(is_enabled) = metrics_enabled.get(identifier) { - u8::from(!*is_enabled) + + if !remote_settings_config.metrics_enabled.is_empty() { + if let Some(is_enabled) = remote_settings_config.metrics_enabled.get(identifier) { + u8::from(!*is_enabled) + } else { + u8::from(self.meta().inner.disabled) + } } else { u8::from(self.meta().inner.disabled) } diff --git a/third_party/rust/glean-core/src/metrics/object.rs b/third_party/rust/glean-core/src/metrics/object.rs index 6071e2b33a..58c8a04c73 100644 --- a/third_party/rust/glean-core/src/metrics/object.rs +++ b/third_party/rust/glean-core/src/metrics/object.rs @@ -48,6 +48,10 @@ impl ObjectMetric { /// * `value` - the value to set. #[doc(hidden)] pub fn set_sync(&self, glean: &Glean, value: JsonValue) { + if !self.should_record(glean) { + return; + } + let value = Metric::Object(serde_json::to_string(&value).unwrap()); glean.storage().record(glean, &self.meta, &value) } @@ -65,6 +69,31 @@ impl ObjectMetric { crate::launch_with_glean(move |glean| metric.set_sync(glean, value)) } + /// Sets to the specified structure. + /// + /// Parses the passed JSON string. + /// If it can't be parsed into a valid object it records an invalid value error. + /// + /// Note: This does not check the structure. This needs to be done by the wrapper. + /// + /// # Arguments + /// + /// * `object` - JSON representation of the object to set. + pub fn set_string(&self, object: String) { + let metric = self.clone(); + crate::launch_with_glean(move |glean| { + let object = match serde_json::from_str(&object) { + Ok(object) => object, + Err(_) => { + let msg = "Value did not match predefined schema"; + record_error(glean, &metric.meta, ErrorType::InvalidValue, msg, None); + return; + } + }; + metric.set_sync(glean, object) + }) + } + /// Record an `InvalidValue` error for this metric. /// /// Only to be used by the RLB. diff --git a/third_party/rust/glean-core/src/metrics/ping.rs b/third_party/rust/glean-core/src/metrics/ping.rs index 5defab7a71..1c5b93c165 100644 --- a/third_party/rust/glean-core/src/metrics/ping.rs +++ b/third_party/rust/glean-core/src/metrics/ping.rs @@ -29,13 +29,12 @@ struct InnerPing { pub precise_timestamps: bool, /// Whether to include the {client|ping}_info sections on assembly. pub include_info_sections: bool, + /// Whether this ping is enabled. + pub enabled: bool, + /// Other pings that should be scheduled when this ping is sent. + pub schedules_pings: Vec, /// The "reason" codes that this ping can send pub reason_codes: Vec, - - /// Whether this ping is enabled. - /// Note: Data for disabled pings is still recorded. - /// It will not be cleared out on submit. - enabled: bool, } impl fmt::Debug for PingType { @@ -46,6 +45,8 @@ impl fmt::Debug for PingType { .field("send_if_empty", &self.0.send_if_empty) .field("precise_timestamps", &self.0.precise_timestamps) .field("include_info_sections", &self.0.include_info_sections) + .field("enabled", &self.0.enabled) + .field("schedules_pings", &self.0.schedules_pings) .field("reason_codes", &self.0.reason_codes) .finish() } @@ -64,13 +65,20 @@ impl PingType { /// * `name` - The name of the ping. /// * `include_client_id` - Whether to include the client ID in the assembled ping when submitting. /// * `send_if_empty` - Whether the ping should be sent empty or not. + /// * `precise_timestamps` - Whether the ping should use precise timestamps for the start and end time. + /// * `include_info_sections` - Whether the ping should include the client/ping_info sections. + /// * `enabled` - Whether or not this ping is enabled. Note: Data that would be sent on a disabled + /// ping will still be collected but is discarded rather than being submitted. /// * `reason_codes` - The valid reason codes for this ping. + #[allow(clippy::too_many_arguments)] pub fn new>( name: A, include_client_id: bool, send_if_empty: bool, precise_timestamps: bool, include_info_sections: bool, + enabled: bool, + schedules_pings: Vec, reason_codes: Vec, ) -> Self { Self::new_internal( @@ -79,19 +87,22 @@ impl PingType { send_if_empty, precise_timestamps, include_info_sections, + enabled, + schedules_pings, reason_codes, - true, ) } + #[allow(clippy::too_many_arguments)] pub(crate) fn new_internal>( name: A, include_client_id: bool, send_if_empty: bool, precise_timestamps: bool, include_info_sections: bool, - reason_codes: Vec, enabled: bool, + schedules_pings: Vec, + reason_codes: Vec, ) -> Self { let this = Self(Arc::new(InnerPing { name: name.into(), @@ -99,8 +110,9 @@ impl PingType { send_if_empty, precise_timestamps, include_info_sections, - reason_codes, enabled, + schedules_pings, + reason_codes, })); // Register this ping. @@ -130,6 +142,22 @@ impl PingType { self.0.include_info_sections } + pub(crate) fn enabled(&self, glean: &Glean) -> bool { + let remote_settings_config = &glean.remote_settings_config.lock().unwrap(); + + if !remote_settings_config.pings_enabled.is_empty() { + if let Some(remote_enabled) = remote_settings_config.pings_enabled.get(self.name()) { + return *remote_enabled; + } + } + + self.0.enabled + } + + pub(crate) fn schedules_pings(&self) -> &[String] { + &self.0.schedules_pings + } + /// Submits the ping for eventual uploading. /// /// The ping content is assembled as soon as possible, but upload is not @@ -166,11 +194,6 @@ impl PingType { /// Whether the ping was succesfully assembled and queued. #[doc(hidden)] pub fn submit_sync(&self, glean: &Glean, reason: Option<&str>) -> bool { - if !self.0.enabled { - log::info!("Ping disabled: not submitting '{}' ping.", self.0.name); - return false; - } - if !glean.is_upload_enabled() { log::info!("Glean disabled: not submitting any pings."); return false; @@ -208,6 +231,15 @@ impl PingType { false } Some(ping) => { + if !self.enabled(glean) { + log::info!( + "The ping '{}' is disabled and will be discarded and not submitted", + ping.name + ); + + return false; + } + // This metric is recorded *after* the ping is collected (since // that is the only way to know *if* it will be submitted). The // implication of this is that the count for a metrics ping will @@ -219,7 +251,10 @@ impl PingType { .add_sync(glean, 1); if let Err(e) = ping_maker.store_ping(glean.get_data_path(), &ping) { - log::warn!("IO error while writing ping to file: {}. Enqueuing upload of what we have in memory.", e); + log::warn!( + "IO error while writing ping to file: {}. Enqueuing upload of what we have in memory.", + e + ); glean.additional_metrics.io_errors.add_sync(glean, 1); // `serde_json::to_string` only fails if serialization of the content // fails or it contains maps with non-string keys. @@ -248,6 +283,17 @@ impl PingType { ping.name ); + if !ping.schedules_pings.is_empty() { + log::info!( + "The ping '{}' is being used to schedule other pings: {:?}", + ping.name, + ping.schedules_pings + ); + for scheduled_ping_name in &ping.schedules_pings { + glean.submit_ping_by_name(scheduled_ping_name, reason); + } + } + true } } diff --git a/third_party/rust/glean-core/src/metrics/remote_settings_config.rs b/third_party/rust/glean-core/src/metrics/remote_settings_config.rs new file mode 100644 index 0000000000..e7a560e81c --- /dev/null +++ b/third_party/rust/glean-core/src/metrics/remote_settings_config.rs @@ -0,0 +1,52 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +use std::collections::HashMap; + +use serde::{Deserialize, Serialize}; + +/// Represents a list of metrics and an associated boolean property +/// indicating if the metric is enabledfrom the remote-settings +/// configuration store. The expected format of this data is stringified JSON +/// in the following format: +/// ```json +/// { +/// "category.metric_name": true +/// } +/// ``` +#[derive(Serialize, Deserialize, Debug, Clone, Default)] +pub struct RemoteSettingsConfig { + /// This is a `HashMap` consisting of base_identifiers as keys + /// and bool values representing an override for the `disabled` + /// property of the metric, only inverted to reduce confusion. + /// If a particular metric has a value of `true` here, it means + /// the default of the metric will be overriden and set to the + /// enabled state. + #[serde(default)] + pub metrics_enabled: HashMap, + + /// This is a `HashMap` consisting of ping names as keys and + /// boolean values representing on override for the default + /// enabled state of the ping of the same name. + #[serde(default)] + pub pings_enabled: HashMap, +} + +impl RemoteSettingsConfig { + /// Creates a new RemoteSettingsConfig + pub fn new() -> Self { + Default::default() + } +} + +impl TryFrom for RemoteSettingsConfig { + type Error = crate::ErrorKind; + + fn try_from(json: String) -> Result { + match serde_json::from_str(json.as_str()) { + Ok(config) => Ok(config), + Err(e) => Err(crate::ErrorKind::Json(e)), + } + } +} diff --git a/third_party/rust/glean-core/src/ping/mod.rs b/third_party/rust/glean-core/src/ping/mod.rs index d1a67ae360..8af4cd27f4 100644 --- a/third_party/rust/glean-core/src/ping/mod.rs +++ b/third_party/rust/glean-core/src/ping/mod.rs @@ -32,6 +32,8 @@ pub struct Ping<'a> { pub headers: HeaderMap, /// Whether the content contains {client|ping}_info sections. pub includes_info_sections: bool, + /// Other pings that should be scheduled when this ping is sent. + pub schedules_pings: Vec, } /// Collect a ping's data, assemble it into its full payload and store it on disk. @@ -314,6 +316,7 @@ impl PingMaker { url_path, headers: self.get_headers(glean), includes_info_sections: ping.include_info_sections(), + schedules_pings: ping.schedules_pings().to_vec(), }) } diff --git a/third_party/rust/glean-core/src/upload/directory.rs b/third_party/rust/glean-core/src/upload/directory.rs index 91a4d061d1..b083fa8f1f 100644 --- a/third_party/rust/glean-core/src/upload/directory.rs +++ b/third_party/rust/glean-core/src/upload/directory.rs @@ -337,7 +337,7 @@ mod test { let (mut glean, dir) = new_glean(None); // Register a ping for testing - let ping_type = PingType::new("test", true, true, true, true, vec![]); + let ping_type = PingType::new("test", true, true, true, true, true, vec![], vec![]); glean.register_ping_type(&ping_type); // Submit the ping to populate the pending_pings directory @@ -364,7 +364,7 @@ mod test { let (mut glean, dir) = new_glean(None); // Register a ping for testing - let ping_type = PingType::new("test", true, true, true, true, vec![]); + let ping_type = PingType::new("test", true, true, true, true, true, vec![], vec![]); glean.register_ping_type(&ping_type); // Submit the ping to populate the pending_pings directory @@ -400,7 +400,7 @@ mod test { let (mut glean, dir) = new_glean(None); // Register a ping for testing - let ping_type = PingType::new("test", true, true, true, true, vec![]); + let ping_type = PingType::new("test", true, true, true, true, true, vec![], vec![]); glean.register_ping_type(&ping_type); // Submit the ping to populate the pending_pings directory diff --git a/third_party/rust/glean-core/src/upload/mod.rs b/third_party/rust/glean-core/src/upload/mod.rs index f217137f00..83b06cca65 100644 --- a/third_party/rust/glean-core/src/upload/mod.rs +++ b/third_party/rust/glean-core/src/upload/mod.rs @@ -1031,6 +1031,8 @@ mod test { /* send_if_empty */ true, true, true, + true, + vec![], vec![], ); glean.register_ping_type(&ping_type); @@ -1070,6 +1072,8 @@ mod test { /* send_if_empty */ true, true, true, + true, + vec![], vec![], ); glean.register_ping_type(&ping_type); @@ -1107,6 +1111,8 @@ mod test { /* send_if_empty */ true, true, true, + true, + vec![], vec![], ); glean.register_ping_type(&ping_type); @@ -1144,6 +1150,8 @@ mod test { /* send_if_empty */ true, true, true, + true, + vec![], vec![], ); glean.register_ping_type(&ping_type); @@ -1181,6 +1189,8 @@ mod test { /* send_if_empty */ true, true, true, + true, + vec![], vec![], ); glean.register_ping_type(&ping_type); @@ -1220,6 +1230,8 @@ mod test { /* send_if_empty */ true, true, true, + true, + vec![], vec![], ); glean.register_ping_type(&ping_type); @@ -1335,6 +1347,8 @@ mod test { /* send_if_empty */ true, true, true, + true, + vec![], vec![], ); glean.register_ping_type(&ping_type); @@ -1408,6 +1422,8 @@ mod test { /* send_if_empty */ true, true, true, + true, + vec![], vec![], ); glean.register_ping_type(&ping_type); @@ -1465,6 +1481,8 @@ mod test { /* send_if_empty */ true, true, true, + true, + vec![], vec![], ); glean.register_ping_type(&ping_type); @@ -1543,6 +1561,8 @@ mod test { /* send_if_empty */ true, true, true, + true, + vec![], vec![], ); glean.register_ping_type(&ping_type); @@ -1622,6 +1642,8 @@ mod test { /* send_if_empty */ true, true, true, + true, + vec![], vec![], ); glean.register_ping_type(&ping_type); @@ -1703,6 +1725,8 @@ mod test { /* send_if_empty */ true, true, true, + true, + vec![], vec![], ); glean.register_ping_type(&ping_type); diff --git a/third_party/rust/glean-core/tests/event.rs b/third_party/rust/glean-core/tests/event.rs index 48120956d7..20bf943113 100644 --- a/third_party/rust/glean-core/tests/event.rs +++ b/third_party/rust/glean-core/tests/event.rs @@ -167,6 +167,8 @@ fn test_sending_of_event_ping_when_it_fills_up() { false, true, true, + true, + vec![], vec!["max_capacity".to_string()], )); } @@ -452,6 +454,8 @@ fn event_storage_trimming() { false, true, true, + true, + vec![], vec![], )); diff --git a/third_party/rust/glean-core/tests/ping.rs b/third_party/rust/glean-core/tests/ping.rs index 17944b4c24..42f93e08c7 100644 --- a/third_party/rust/glean-core/tests/ping.rs +++ b/third_party/rust/glean-core/tests/ping.rs @@ -15,7 +15,7 @@ use glean_core::Lifetime; fn write_ping_to_disk() { let (mut glean, _temp) = new_glean(None); - let ping = PingType::new("metrics", true, false, true, true, vec![]); + let ping = PingType::new("metrics", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&ping); // We need to store a metric as an empty ping is not stored. @@ -36,7 +36,7 @@ fn write_ping_to_disk() { fn disabling_upload_clears_pending_pings() { let (mut glean, _t) = new_glean(None); - let ping = PingType::new("metrics", true, false, true, true, vec![]); + let ping = PingType::new("metrics", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&ping); // We need to store a metric as an empty ping is not stored. @@ -105,9 +105,18 @@ fn deletion_request_only_when_toggled_from_on_to_off() { fn empty_pings_with_flag_are_sent() { let (mut glean, _t) = new_glean(None); - let ping1 = PingType::new("custom-ping1", true, true, true, true, vec![]); + let ping1 = PingType::new("custom-ping1", true, true, true, true, true, vec![], vec![]); glean.register_ping_type(&ping1); - let ping2 = PingType::new("custom-ping2", true, false, true, true, vec![]); + let ping2 = PingType::new( + "custom-ping2", + true, + false, + true, + true, + true, + vec![], + vec![], + ); glean.register_ping_type(&ping2); // No data is stored in either of the custom pings @@ -139,10 +148,10 @@ fn test_pings_submitted_metric() { None, ); - let metrics_ping = PingType::new("metrics", true, false, true, true, vec![]); + let metrics_ping = PingType::new("metrics", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&metrics_ping); - let baseline_ping = PingType::new("baseline", true, false, true, true, vec![]); + let baseline_ping = PingType::new("baseline", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&baseline_ping); // We need to store a metric as an empty ping is not stored. @@ -218,7 +227,7 @@ fn test_pings_submitted_metric() { fn events_ping_with_metric_but_no_events_is_not_sent() { let (mut glean, _t) = new_glean(None); - let events_ping = PingType::new("events", true, true, true, true, vec![]); + let events_ping = PingType::new("events", true, true, true, true, true, vec![], vec![]); glean.register_ping_type(&events_ping); let counter = CounterMetric::new(CommonMetricData { name: "counter".into(), @@ -247,3 +256,26 @@ fn events_ping_with_metric_but_no_events_is_not_sent() { assert!(events_ping.submit_sync(&glean, None)); assert_eq!(1, get_queued_pings(glean.get_data_path()).unwrap().len()); } + +#[test] +fn test_scheduled_pings_are_sent() { + let (mut glean, _t) = new_glean(None); + + let piggyback_ping = PingType::new("piggyback", true, true, true, true, true, vec![], vec![]); + glean.register_ping_type(&piggyback_ping); + + let trigger_ping = PingType::new( + "trigger", + true, + true, + true, + true, + true, + vec!["piggyback".into()], + vec![], + ); + glean.register_ping_type(&trigger_ping); + + assert!(trigger_ping.submit_sync(&glean, None)); + assert_eq!(2, get_queued_pings(glean.get_data_path()).unwrap().len()); +} diff --git a/third_party/rust/glean-core/tests/ping_maker.rs b/third_party/rust/glean-core/tests/ping_maker.rs index f716dc4692..ac2dcbee11 100644 --- a/third_party/rust/glean-core/tests/ping_maker.rs +++ b/third_party/rust/glean-core/tests/ping_maker.rs @@ -13,7 +13,7 @@ fn set_up_basic_ping() -> (Glean, PingMaker, PingType, tempfile::TempDir) { let (tempdir, _) = tempdir(); let (mut glean, t) = new_glean(Some(tempdir)); let ping_maker = PingMaker::new(); - let ping_type = PingType::new("store1", true, false, true, true, vec![]); + let ping_type = PingType::new("store1", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&ping_type); // Record something, so the ping will have data @@ -95,7 +95,7 @@ fn test_metrics_must_report_experimentation_id() { }) .unwrap(); let ping_maker = PingMaker::new(); - let ping_type = PingType::new("store1", true, false, true, true, vec![]); + let ping_type = PingType::new("store1", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&ping_type); // Record something, so the ping will have data @@ -149,7 +149,7 @@ fn experimentation_id_is_removed_if_send_if_empty_is_false() { .unwrap(); let ping_maker = PingMaker::new(); - let unknown_ping_type = PingType::new("unknown", true, false, true, true, vec![]); + let unknown_ping_type = PingType::new("unknown", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&unknown_ping_type); assert!(ping_maker @@ -165,7 +165,7 @@ fn collect_must_report_none_when_no_data_is_stored() { let (mut glean, ping_maker, ping_type, _t) = set_up_basic_ping(); - let unknown_ping_type = PingType::new("unknown", true, false, true, true, vec![]); + let unknown_ping_type = PingType::new("unknown", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&ping_type); assert!(ping_maker @@ -189,7 +189,8 @@ fn seq_number_must_be_sequential() { for i in 0..=1 { for ping_name in ["store1", "store2"].iter() { - let ping_type = PingType::new(*ping_name, true, false, true, true, vec![]); + let ping_type = + PingType::new(*ping_name, true, false, true, true, true, vec![], vec![]); let ping = ping_maker .collect(&glean, &ping_type, None, "", "") .unwrap(); @@ -202,7 +203,7 @@ fn seq_number_must_be_sequential() { // Test that ping sequence numbers increase independently. { - let ping_type = PingType::new("store1", true, false, true, true, vec![]); + let ping_type = PingType::new("store1", true, false, true, true, true, vec![], vec![]); // 3rd ping of store1 let ping = ping_maker @@ -220,7 +221,7 @@ fn seq_number_must_be_sequential() { } { - let ping_type = PingType::new("store2", true, false, true, true, vec![]); + let ping_type = PingType::new("store2", true, false, true, true, true, vec![], vec![]); // 3rd ping of store2 let ping = ping_maker @@ -231,7 +232,7 @@ fn seq_number_must_be_sequential() { } { - let ping_type = PingType::new("store1", true, false, true, true, vec![]); + let ping_type = PingType::new("store1", true, false, true, true, true, vec![], vec![]); // 5th ping of store1 let ping = ping_maker @@ -246,7 +247,7 @@ fn seq_number_must_be_sequential() { fn clear_pending_pings() { let (mut glean, _t) = new_glean(None); let ping_maker = PingMaker::new(); - let ping_type = PingType::new("store1", true, false, true, true, vec![]); + let ping_type = PingType::new("store1", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&ping_type); // Record something, so the ping will have data @@ -274,7 +275,7 @@ fn no_pings_submitted_if_upload_disabled() { // Regression test, bug 1603571 let (mut glean, _t) = new_glean(None); - let ping_type = PingType::new("store1", true, true, true, true, vec![]); + let ping_type = PingType::new("store1", true, true, true, true, true, vec![], vec![]); glean.register_ping_type(&ping_type); assert!(ping_type.submit_sync(&glean, None)); @@ -292,7 +293,7 @@ fn no_pings_submitted_if_upload_disabled() { fn metadata_is_correctly_added_when_necessary() { let (mut glean, _t) = new_glean(None); glean.set_debug_view_tag("valid-tag"); - let ping_type = PingType::new("store1", true, true, true, true, vec![]); + let ping_type = PingType::new("store1", true, true, true, true, true, vec![], vec![]); glean.register_ping_type(&ping_type); assert!(ping_type.submit_sync(&glean, None)); -- cgit v1.2.3