diff options
Diffstat (limited to 'third_party/rust/glean-core')
32 files changed, 141 insertions, 66 deletions
diff --git a/third_party/rust/glean-core/.cargo-checksum.json b/third_party/rust/glean-core/.cargo-checksum.json index 54674fc768..663b3141c3 100644 --- a/third_party/rust/glean-core/.cargo-checksum.json +++ b/third_party/rust/glean-core/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"2dde200f0e0e4e523634f8c2c8c1c2ca75af83163ac7b0ba8f62f3096fd0c97d","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"026495898699b54608eb4ec16074ffafc57920d80ccb59961c501a1ea28c9985","build.rs":"4857bea99c6b8c08db8818efa9d3738716f52d3acb68159323957ae52892a3eb","src/common_metric_data.rs":"72051c4349885d4a94fc41bb4edda88d31551f2f9ebcdb4e868a98161bc76233","src/core/mod.rs":"8f5e98a108ec5d1849402af1de90b5f53ba839240743c2c5283a49a4045e1293","src/core_metrics.rs":"a877e42e0f8b932adb52a5681ad76fd977808cb48c7eeb29b1e4bbe804f1ea96","src/coverage.rs":"49613fd310bd24d779472720975fbe6c97ec370a95eb55f10afa43f67539c942","src/database/mod.rs":"3917bad7773696a43ab58e7860d5a8f1d63dca7c27920343aa8786acc5a586cd","src/debug.rs":"90158cc5d488ba67b60d06647e54e59a1d7bdeb906087e4fe4cfab4373c1cc6c","src/dispatcher/global.rs":"f69cd81a90a37c306d4e0ce8177ea5a3ae2ffda5b431ae46b9a22c9e38891271","src/dispatcher/mod.rs":"440a331a7beeaa6e9824c2fd4306c09ce2a115a358d5beb830dba4d69aec3563","src/error.rs":"b93c7d3e243b21bb9eafc95f17860aba1a942b2f2b0a7f43307690f05fece516","src/error_recording.rs":"d7858647808d81173558e12de88f3fbe4e589969e3bd246bfb388f90f8ff3814","src/event_database/mod.rs":"9d4d3e4b075dc585c00317304401b2c9115f39db8fdbd9f1c93d3fc6fd350fd5","src/fd_logger.rs":"0c9def6fa53db1a2ab93c85795f8a7df57797bcfd3978146923e151752e291a6","src/glean.udl":"24d9e431f95d79dc4254feff68f19a4ea4e6e76c33b110e10c5e5dbd5bc64ff2","src/glean_metrics.rs":"9414fb1453d19f6832df33e4c6ef7383d62203e47026bf5bc9552b083101ddd1","src/histogram/exponential.rs":"58bb1770bae45770d92995515d328eb50a7e78726224f779446ae7d1632a6a3e","src/histogram/functional.rs":"1a63a305b48bcef7bc38136b40d916df4bb8f098dc602514ada54a9b091f6951","src/histogram/linear.rs":"4342a1733175d7f97b2b41adb18100537c206100c9fccb5bd13bd782c9cb3c9a","src/histogram/mod.rs":"eeb7aff80806ab76cdce101dc08887b5552f8b4bdf64683f64f767e0f06a889d","src/internal_metrics.rs":"263779535963a804c8c7fa6f8e284ac8ec7f415ceeadbb6a8f913a1e7073ae18","src/internal_pings.rs":"7267166a8e357053526c545cf62bb502a7b6f07aed1de48d43041228d8835366","src/lib.rs":"367ea21f9d3f1c808b258011821d8505cd47d29eff8e8e6d938623e6e9997b73","src/lib_unit_tests.rs":"46897c6bb4003c5e00152d7b55c00d3176b5bffb28d8669a3fb0d10e5233e3a5","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":"7281d8b63f34758a47abd7ae3956f44701d1fd48433ccba7a4302526a9912255","src/metrics/experiment.rs":"5f9278cca4e133eb8df33bbfe36d1fe0ef3eade8c09f1b46db3c4d0790515412","src/metrics/labeled.rs":"8d6e76a07064d132cd617c7901f2bc11ff6ba31e3483ba3b96354a4a3736b58d","src/metrics/memory_distribution.rs":"7f6ca51acb470df277ff14427c0e7bb07d921c0a0087d0cc56aebe038d198ccc","src/metrics/memory_unit.rs":"d7a678e5242febd021283b30c0099a9e62729944816a3f17d2d91e2808bc0570","src/metrics/metrics_enabled_config.rs":"87fed12219c756ecf1e5c8cd6a21f26999b6bbcf3ffc1b5467b0a58ca5ad35d8","src/metrics/mod.rs":"8f8958b8cedfe01df6c97ec26b63f14fd7516f9de7ba62984062db96b5708720","src/metrics/numerator.rs":"937dfd583b797ac798a525cedca95c5a36262356760a89670d8113983c263154","src/metrics/object.rs":"89ce5190ed681b26b74a06a4ecaf9f96c36f96be1276f1fdb40f4406648e08c1","src/metrics/ping.rs":"4ccdf0ae2ac6f3e5a352334797d2805f1a3d932e92f08447285dd9bec4e7d724","src/metrics/quantity.rs":"aa13a8f8cf8e5e0281668fbbafc2998411df2a499479423558fd91b9bd7f8702","src/metrics/rate.rs":"603cc45c149c7a27c93b6a80146bf43f8ce70d9655f905bb5be6bc2c15bcb22b","src/metrics/recorded_experiment.rs":"33958abee79d8b55dec4cb5d20742640423713010f76314075cefde18b5c118a","src/metrics/string.rs":"2418632c492463970c3eca533d5318f519698bb361d73dd8781db108d7d1fbd8","src/metrics/string_list.rs":"ed53a095184c3e8224d0511809b5d7601ba3166505a39b0570f24ebeb0a5b97c","src/metrics/text.rs":"5c994a282b16b9dde6d6dc4922475457a72c82f64248778811b84db70ed4c116","src/metrics/time_unit.rs":"b7578010c6270a45b30342b59189a862b2ede9dd24e9afae3e90fa6b970b3d24","src/metrics/timespan.rs":"b0fda3a45597c8306a0d1928dcf0837538859e66ebd9db113ebb6efbea721d4c","src/metrics/timing_distribution.rs":"5da04272dd8b44502ffd0b60b12c84239a7fe359a51754b6c0cd96388a4e8a3c","src/metrics/url.rs":"f6b27a60d13a1268f0115c5d292c9b16b6bc370055961368cb2648283b7140a0","src/metrics/uuid.rs":"cacffd95ab30ed327ec2fa5feaf1359e667706746401f1e2c1195ad9553c4b54","src/ping/mod.rs":"fcadd52d2d536c9ace01f8a3812c3fb3c39b8094915db1b3656839fb87f771b5","src/scheduler.rs":"129863e31205404a3d1708627a62583324c347d143f976216f769893ec541ea0","src/storage/mod.rs":"04dc1a94be1d59097cd87b14386952a6ec8b9115bc06397ae389a323f6f55dcc","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":"3f48aa336854141784d121f7fa9e283f6ff708a9214f9c0aade3a68cc38dda99","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":"6359220db9d85ee0f3931ca518f95ffb2020c1c03bd632f17ed5c16ddd00343b","src/upload/mod.rs":"a388563d5e2940c5c28b48fc7b67ca507512efccae95fd1c2f04b15ec21aa08c","src/upload/policy.rs":"c250957a37783e74af8002cd80ba06ef9780a389fb0f61b8b665b79688f0a360","src/upload/request.rs":"0b7e215f61499a681d1cebc9cf4a0efbaae2f543a5d44e5db40cbe61ed90549e","src/upload/result.rs":"7efbbe50e8d36beb3f23e7bfd172d22e1c003472d2dd8055b06f6050c36437c5","src/util.rs":"ee7500434d9758a320dd410f18d7e18da956591e19d2555db87eef9623e4b916","tests/boolean.rs":"76d6014ff108cb6514d9bceb1b2b14749a55b09921f4595a5e30f1bd3546e9f0","tests/common/mod.rs":"c1d980a9cff0b64f452ebbe43f24d70aa685b80b48db08fc4338a60466b07a5e","tests/counter.rs":"3663a3f5ec5c0bd2b758a9920cd20cc619a12566b445e4421ec7c98232bf5a32","tests/custom_distribution.rs":"41c593a0b4561e21f29d1a5b948de964a866253c58ca76ffefebe370fca150e0","tests/datetime.rs":"ec3c9760e70bb2cbc61ab23281c891bc1ec493c5c545466c29fd13e4f05c2c96","tests/event.rs":"67291cbcc4d1cba56ada6ba733fb1dc4c6327680059e8d7637add2ae45cd344b","tests/labeled.rs":"e9ea6dba17059d68114efce0c23373be9ceed922bf5e638a2158a6422c75a1c1","tests/memory_distribution.rs":"a5a7aa955e60823ea29a6f4bc96c61e41f1e41f08958aa4854668cf8fe04cde6","tests/object.rs":"8c35676e04f6ccf54a28764700915e753fc0355bfa5d7804d72caba66fd564cd","tests/ping.rs":"eb9f6be1aba21acc5dc670622bf622976718a706df1cc2095efa56a8e8b3fe1a","tests/ping_maker.rs":"b267ecf7c714ff27512424b743da0ea4f05a87755c1b96355bfca3e173e3f62e","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":"ed9acc46fd38c5c995a0537e76364496addace660839dc279079e5957e3c1093"}
\ No newline at end of file +{"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 diff --git a/third_party/rust/glean-core/Cargo.toml b/third_party/rust/glean-core/Cargo.toml index 9d33444fbd..932b16a4a7 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 = "58.1.0" +version = "59.0.0" authors = [ "Jan-Erik Rediger <jrediger@mozilla.com>", "The Glean Team <glean-team@mozilla.com>", @@ -80,7 +80,7 @@ version = "1.0.4" version = "0.1.40" [dependencies.uniffi] -version = "0.25.2" +version = "0.27.0" default-features = false [dependencies.uuid] @@ -105,7 +105,7 @@ version = "0.4" version = "3.8.0" [build-dependencies.uniffi] -version = "0.25.2" +version = "0.27.0" features = ["build"] default-features = false 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 033cbe1472..9bda9bb462 100644 --- a/third_party/rust/glean-core/src/common_metric_data.rs +++ b/third_party/rust/glean-core/src/common_metric_data.rs @@ -2,7 +2,6 @@ // 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::convert::TryFrom; use std::sync::atomic::{AtomicU8, Ordering}; use crate::error::{Error, ErrorKind}; diff --git a/third_party/rust/glean-core/src/core/mod.rs b/third_party/rust/glean-core/src/core/mod.rs index 30f9a34f11..f69f0c3868 100644 --- a/third_party/rust/glean-core/src/core/mod.rs +++ b/third_party/rust/glean-core/src/core/mod.rs @@ -120,6 +120,7 @@ where /// rate_limit: None, /// enable_event_timestamps: true, /// experimentation_id: None, +/// enable_internal_pings: true, /// }; /// let mut glean = Glean::new(cfg).unwrap(); /// let ping = PingType::new("sample", true, false, true, true, vec![]); @@ -208,7 +209,7 @@ impl Glean { core_metrics: CoreMetrics::new(), additional_metrics: AdditionalMetrics::new(), database_metrics: DatabaseMetrics::new(), - internal_pings: InternalPings::new(), + internal_pings: InternalPings::new(cfg.enable_internal_pings), upload_manager, data_path: PathBuf::from(&cfg.data_path), application_id, @@ -288,7 +289,9 @@ impl Glean { } // We set this only for non-subprocess situations. - glean.schedule_metrics_pings = cfg.use_core_mps; + // If internal pings are disabled, we don't set up the MPS either, + // it wouldn't send any data anyway. + glean.schedule_metrics_pings = cfg.enable_internal_pings && cfg.use_core_mps; // We only scan the pendings pings directories **after** dealing with the upload state. // If upload is disabled, we delete all pending pings files @@ -305,6 +308,7 @@ impl Glean { data_path: &str, application_id: &str, upload_enabled: bool, + enable_internal_pings: bool, ) -> Self { let cfg = InternalConfiguration { data_path: data_path.into(), @@ -320,6 +324,7 @@ impl Glean { rate_limit: None, enable_event_timestamps: true, experimentation_id: None, + enable_internal_pings, }; let mut glean = Self::new(cfg).unwrap(); diff --git a/third_party/rust/glean-core/src/database/mod.rs b/third_party/rust/glean-core/src/database/mod.rs index af473c98d9..0dbf0220bc 100644 --- a/third_party/rust/glean-core/src/database/mod.rs +++ b/third_party/rust/glean-core/src/database/mod.rs @@ -824,7 +824,6 @@ mod test { use super::*; use crate::tests::new_glean; use std::collections::HashMap; - use std::path::Path; use tempfile::tempdir; #[test] diff --git a/third_party/rust/glean-core/src/debug.rs b/third_party/rust/glean-core/src/debug.rs index a572a02b8f..88f807bd88 100644 --- a/third_party/rust/glean-core/src/debug.rs +++ b/third_party/rust/glean-core/src/debug.rs @@ -240,7 +240,6 @@ fn validate_source_tags(tags: &Vec<String>) -> bool { #[cfg(test)] mod test { use super::*; - use std::env; #[test] fn debug_option_is_correctly_loaded_from_env() { diff --git a/third_party/rust/glean-core/src/dispatcher/mod.rs b/third_party/rust/glean-core/src/dispatcher/mod.rs index 48efa4ef96..ead58fb867 100644 --- a/third_party/rust/glean-core/src/dispatcher/mod.rs +++ b/third_party/rust/glean-core/src/dispatcher/mod.rs @@ -360,9 +360,8 @@ impl Dispatcher { #[cfg(test)] mod test { use super::*; - use std::sync::atomic::{AtomicBool, AtomicU8, Ordering}; - use std::sync::{Arc, Mutex}; - use std::{thread, time::Duration}; + use std::sync::atomic::AtomicU8; + use std::sync::Mutex; fn enable_test_logging() { // When testing we want all logs to go to stdout/stderr by default, diff --git a/third_party/rust/glean-core/src/error_recording.rs b/third_party/rust/glean-core/src/error_recording.rs index aaf850d019..fa828242f1 100644 --- a/third_party/rust/glean-core/src/error_recording.rs +++ b/third_party/rust/glean-core/src/error_recording.rs @@ -12,7 +12,6 @@ //! but are not actually used directly, since the `send_in_pings` value needs to match the pings of the metric that is erroring (plus the "metrics" ping), //! not some constant value that we could define in `metrics.yaml`. -use std::convert::TryFrom; use std::fmt::Display; use crate::common_metric_data::CommonMetricDataInternal; diff --git a/third_party/rust/glean-core/src/event_database/mod.rs b/third_party/rust/glean-core/src/event_database/mod.rs index d83e56fbec..50b2488a4c 100644 --- a/third_party/rust/glean-core/src/event_database/mod.rs +++ b/third_party/rust/glean-core/src/event_database/mod.rs @@ -4,7 +4,6 @@ use std::cmp::Ordering; use std::collections::HashMap; -use std::convert::TryFrom; use std::fs; use std::fs::{create_dir_all, File, OpenOptions}; use std::io::BufRead; @@ -638,8 +637,8 @@ impl EventDatabase { #[cfg(test)] mod test { use super::*; + use crate::test_get_num_recorded_errors; use crate::tests::new_glean; - use crate::{test_get_num_recorded_errors, CommonMetricData}; use chrono::{TimeZone, Timelike}; #[test] diff --git a/third_party/rust/glean-core/src/glean.udl b/third_party/rust/glean-core/src/glean.udl index e68a57ea4c..dc71fea594 100644 --- a/third_party/rust/glean-core/src/glean.udl +++ b/third_party/rust/glean-core/src/glean.udl @@ -90,6 +90,7 @@ dictionary InternalConfiguration { PingRateLimit? rate_limit; boolean enable_event_timestamps; string? experimentation_id; + boolean enable_internal_pings; }; // How to specify the rate pings may be uploaded before they are throttled. diff --git a/third_party/rust/glean-core/src/histogram/mod.rs b/third_party/rust/glean-core/src/histogram/mod.rs index 282b02e0ab..6e2880dffa 100644 --- a/third_party/rust/glean-core/src/histogram/mod.rs +++ b/third_party/rust/glean-core/src/histogram/mod.rs @@ -5,7 +5,6 @@ //! A simple histogram implementation for exponential histograms. use std::collections::HashMap; -use std::convert::TryFrom; use serde::{Deserialize, Serialize}; diff --git a/third_party/rust/glean-core/src/internal_pings.rs b/third_party/rust/glean-core/src/internal_pings.rs index 07c3849006..1cf32feb60 100644 --- a/third_party/rust/glean-core/src/internal_pings.rs +++ b/third_party/rust/glean-core/src/internal_pings.rs @@ -19,9 +19,9 @@ pub struct InternalPings { } impl InternalPings { - pub fn new() -> InternalPings { + pub fn new(enabled: bool) -> InternalPings { InternalPings { - baseline: PingType::new( + baseline: PingType::new_internal( "baseline", true, true, @@ -32,8 +32,9 @@ impl InternalPings { "dirty_startup".to_string(), "inactive".to_string(), ], + enabled, ), - metrics: PingType::new( + metrics: PingType::new_internal( "metrics", true, false, @@ -46,8 +47,9 @@ impl InternalPings { "tomorrow".to_string(), "upgrade".to_string(), ], + enabled, ), - events: PingType::new( + events: PingType::new_internal( "events", true, false, @@ -58,6 +60,7 @@ impl InternalPings { "inactive".to_string(), "max_capacity".to_string(), ], + enabled, ), deletion_request: PingType::new( "deletion-request", diff --git a/third_party/rust/glean-core/src/lib.rs b/third_party/rust/glean-core/src/lib.rs index b7f9d73beb..af68fde264 100644 --- a/third_party/rust/glean-core/src/lib.rs +++ b/third_party/rust/glean-core/src/lib.rs @@ -17,7 +17,6 @@ use std::borrow::Cow; use std::collections::HashMap; -use std::convert::TryFrom; use std::fmt; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Mutex}; @@ -25,7 +24,7 @@ use std::thread; use std::time::Duration; use crossbeam_channel::unbounded; -use log::{self, LevelFilter}; +use log::LevelFilter; use once_cell::sync::{Lazy, OnceCell}; use uuid::Uuid; @@ -136,6 +135,8 @@ pub struct InternalConfiguration { /// be noted that this has an underlying StringMetric and so should conform to the limitations that /// StringMetric places on length, etc. pub experimentation_id: Option<String>, + /// Whether to enable internal pings. Default: true + pub enable_internal_pings: bool, } /// How to specify the rate at which pings may be uploaded before they are throttled. 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 cb1e4129d8..14d3b98417 100644 --- a/third_party/rust/glean-core/src/lib_unit_tests.rs +++ b/third_party/rust/glean-core/src/lib_unit_tests.rs @@ -6,12 +6,10 @@ // the lib.rs file. use std::collections::HashSet; -use std::iter::FromIterator; use serde_json::json; use super::*; -use crate::metrics::{StringMetric, TimeUnit, TimespanMetric, TimingDistributionMetric}; const GLOBAL_APPLICATION_ID: &str = "org.mozilla.glean.test.app"; pub fn new_glean(tempdir: Option<tempfile::TempDir>) -> (Glean, tempfile::TempDir) { @@ -21,7 +19,7 @@ pub fn new_glean(tempdir: Option<tempfile::TempDir>) -> (Glean, tempfile::TempDi None => tempfile::tempdir().unwrap(), }; let tmpname = dir.path().display().to_string(); - let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true); + let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, true); (glean, dir) } @@ -41,7 +39,7 @@ fn path_is_constructed_from_data() { fn experiment_id_and_branch_get_truncated_if_too_long() { let t = tempfile::tempdir().unwrap(); let name = t.path().display().to_string(); - let glean = Glean::with_options(&name, "org.mozilla.glean.tests", true); + let glean = Glean::with_options(&name, "org.mozilla.glean.tests", true, true); // Generate long strings for the used ids. let very_long_id = "test-experiment-id".repeat(10); @@ -82,7 +80,7 @@ fn experiment_id_and_branch_get_truncated_if_too_long() { fn limits_on_experiments_extras_are_applied_correctly() { let t = tempfile::tempdir().unwrap(); let name = t.path().display().to_string(); - let glean = Glean::with_options(&name, "org.mozilla.glean.tests", true); + let glean = Glean::with_options(&name, "org.mozilla.glean.tests", true, true); let experiment_id = "test-experiment_id".to_string(); let branch_id = "test-branch-id".to_string(); @@ -138,7 +136,7 @@ fn limits_on_experiments_extras_are_applied_correctly() { fn experiments_status_is_correctly_toggled() { let t = tempfile::tempdir().unwrap(); let name = t.path().display().to_string(); - let glean = Glean::with_options(&name, "org.mozilla.glean.tests", true); + let glean = Glean::with_options(&name, "org.mozilla.glean.tests", true, true); // Define the experiment's data. let experiment_id: String = "test-toggle-experiment".into(); @@ -199,6 +197,7 @@ fn experimentation_id_is_set_correctly() { rate_limit: None, enable_event_timestamps: true, experimentation_id: Some(experimentation_id.to_string()), + enable_internal_pings: true, }) .unwrap(); @@ -219,7 +218,7 @@ fn client_id_and_first_run_date_must_be_regenerated() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().display().to_string(); { - let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true); + let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, true); glean.data_store.as_ref().unwrap().clear_all(); @@ -236,7 +235,7 @@ fn client_id_and_first_run_date_must_be_regenerated() { } { - let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true); + let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, true); assert!(glean .core_metrics .client_id @@ -339,7 +338,7 @@ fn client_id_is_managed_correctly_when_toggling_uploading() { fn client_id_is_set_to_known_value_when_uploading_disabled_at_start() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().display().to_string(); - let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, false); + let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, false, true); assert_eq!( *KNOWN_CLIENT_ID, @@ -355,7 +354,7 @@ fn client_id_is_set_to_known_value_when_uploading_disabled_at_start() { fn client_id_is_set_to_random_value_when_uploading_enabled_at_start() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().display().to_string(); - let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true); + let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, true); let current_client_id = glean .core_metrics @@ -369,7 +368,7 @@ fn client_id_is_set_to_random_value_when_uploading_enabled_at_start() { fn enabling_when_already_enabled_is_a_noop() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().display().to_string(); - let mut glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true); + let mut glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, true); assert!(!glean.set_upload_enabled(true)); } @@ -378,7 +377,7 @@ fn enabling_when_already_enabled_is_a_noop() { fn disabling_when_already_disabled_is_a_noop() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().display().to_string(); - let mut glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, false); + let mut glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, false, true); assert!(!glean.set_upload_enabled(false)); } @@ -601,14 +600,14 @@ fn test_first_run() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().display().to_string(); { - let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true); + let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, true); // Check that this is indeed the first run. assert!(glean.is_first_run()); } { // Other runs must be not marked as "first run". - let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true); + let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, true); assert!(!glean.is_first_run()); } } @@ -618,7 +617,7 @@ fn test_dirty_bit() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().display().to_string(); { - let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true); + let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, true); // The dirty flag must not be set the first time Glean runs. assert!(!glean.is_dirty_flag_set()); @@ -630,7 +629,7 @@ fn test_dirty_bit() { { // Check that next time Glean runs, it correctly picks up the "dirty flag". // It is expected to be 'true'. - let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true); + let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, true); assert!(glean.is_dirty_flag_set()); // Set the dirty flag to false. @@ -641,7 +640,7 @@ fn test_dirty_bit() { { // Check that next time Glean runs, it correctly picks up the "dirty flag". // It is expected to be 'false'. - let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true); + let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, true); assert!(!glean.is_dirty_flag_set()); } } @@ -1065,7 +1064,7 @@ fn test_empty_application_id() { let dir = tempfile::tempdir().unwrap(); let tmpname = dir.path().display().to_string(); - let glean = Glean::with_options(&tmpname, "", true); + let glean = Glean::with_options(&tmpname, "", true, true); // Check that this is indeed the first run. assert!(glean.is_first_run()); } @@ -1080,7 +1079,7 @@ fn records_database_file_size() { let tmpname = dir.path().display().to_string(); // Initialize Glean once to ensure we create the database and did not error. - let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true); + let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, true); let database_size = &glean.database_metrics.size; let data = database_size.get_value(&glean, "metrics"); @@ -1089,7 +1088,7 @@ fn records_database_file_size() { drop(glean); // Initialize Glean again to record file size. - let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true); + let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, true); let database_size = &glean.database_metrics.size; let data = database_size.get_value(&glean, "metrics"); @@ -1161,3 +1160,46 @@ fn test_activity_api() { // Check that we set everything we needed for the 'inactive' status. assert!(!glean.is_dirty_flag_set()); } + +#[test] +fn disabled_pings_are_not_submitted() { + let _ = env_logger::builder().is_test(true).try_init(); + + 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); + glean.register_ping_type(&ping); + + // We need to store a metric as an empty ping is not stored. + let counter = CounterMetric::new(CommonMetricData { + name: "counter".into(), + category: "local".into(), + send_in_pings: vec!["custom-disabled".into()], + ..Default::default() + }); + counter.add_sync(&glean, 1); + + assert!(!ping.submit_sync(&glean, None)); +} + +#[test] +fn internal_pings_can_be_disabled() { + let _ = env_logger::builder().is_test(true).try_init(); + + let dir = tempfile::tempdir().unwrap(); + let tmpname = dir.path().display().to_string(); + let glean = Glean::with_options(&tmpname, GLOBAL_APPLICATION_ID, true, false); + + // We need to store a metric as an empty ping is not stored. + let counter = CounterMetric::new(CommonMetricData { + name: "counter".into(), + category: "local".into(), + send_in_pings: vec!["baseline".into()], + ..Default::default() + }); + counter.add_sync(&glean, 1); + + let submitted = glean.internal_pings.baseline.submit_sync(&glean, None); + assert!(!submitted); +} diff --git a/third_party/rust/glean-core/src/metrics/event.rs b/third_party/rust/glean-core/src/metrics/event.rs index c7aefd9cd6..74f90f4867 100644 --- a/third_party/rust/glean-core/src/metrics/event.rs +++ b/third_party/rust/glean-core/src/metrics/event.rs @@ -175,9 +175,21 @@ impl EventMetric { .into() .unwrap_or_else(|| &self.meta().inner.send_in_pings[0]); - glean + let events = glean .event_storage() - .test_get_value(&self.meta, queried_ping_name) + .test_get_value(&self.meta, queried_ping_name); + + events.map(|mut evts| { + for ev in &mut evts { + let Some(extra) = &mut ev.extra else { continue }; + extra.remove("glean_timestamp"); + if extra.is_empty() { + ev.extra = None; + } + } + + evts + }) } /// **Test-only API (exported for FFI purposes).** diff --git a/third_party/rust/glean-core/src/metrics/memory_unit.rs b/third_party/rust/glean-core/src/metrics/memory_unit.rs index ce51b975fa..19006a594e 100644 --- a/third_party/rust/glean-core/src/metrics/memory_unit.rs +++ b/third_party/rust/glean-core/src/metrics/memory_unit.rs @@ -2,8 +2,6 @@ // 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::convert::TryFrom; - use serde::{Deserialize, Serialize}; use crate::error::{Error, ErrorKind}; 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 index 26d0deff31..b36cbc150a 100644 --- a/third_party/rust/glean-core/src/metrics/metrics_enabled_config.rs +++ b/third_party/rust/glean-core/src/metrics/metrics_enabled_config.rs @@ -2,7 +2,7 @@ // 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, convert::TryFrom}; +use std::collections::HashMap; use serde::{Deserialize, Serialize}; diff --git a/third_party/rust/glean-core/src/metrics/ping.rs b/third_party/rust/glean-core/src/metrics/ping.rs index e60284b1e2..5defab7a71 100644 --- a/third_party/rust/glean-core/src/metrics/ping.rs +++ b/third_party/rust/glean-core/src/metrics/ping.rs @@ -31,6 +31,11 @@ struct InnerPing { pub include_info_sections: bool, /// The "reason" codes that this ping can send pub reason_codes: Vec<String>, + + /// 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 { @@ -68,6 +73,26 @@ impl PingType { include_info_sections: bool, reason_codes: Vec<String>, ) -> Self { + Self::new_internal( + name, + include_client_id, + send_if_empty, + precise_timestamps, + include_info_sections, + reason_codes, + true, + ) + } + + pub(crate) fn new_internal<A: Into<String>>( + name: A, + include_client_id: bool, + send_if_empty: bool, + precise_timestamps: bool, + include_info_sections: bool, + reason_codes: Vec<String>, + enabled: bool, + ) -> Self { let this = Self(Arc::new(InnerPing { name: name.into(), include_client_id, @@ -75,6 +100,7 @@ impl PingType { precise_timestamps, include_info_sections, reason_codes, + enabled, })); // Register this ping. @@ -140,6 +166,11 @@ 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; diff --git a/third_party/rust/glean-core/src/metrics/string.rs b/third_party/rust/glean-core/src/metrics/string.rs index 4aa30a8d7e..a56ffab648 100644 --- a/third_party/rust/glean-core/src/metrics/string.rs +++ b/third_party/rust/glean-core/src/metrics/string.rs @@ -149,10 +149,8 @@ impl StringMetric { #[cfg(test)] mod test { use super::*; - use crate::test_get_num_recorded_errors; use crate::tests::new_glean; use crate::util::truncate_string_at_boundary; - use crate::ErrorType; use crate::Lifetime; #[test] diff --git a/third_party/rust/glean-core/src/metrics/text.rs b/third_party/rust/glean-core/src/metrics/text.rs index baa8e88d75..35f803c728 100644 --- a/third_party/rust/glean-core/src/metrics/text.rs +++ b/third_party/rust/glean-core/src/metrics/text.rs @@ -153,10 +153,8 @@ impl TextMetric { #[cfg(test)] mod test { use super::*; - use crate::test_get_num_recorded_errors; use crate::tests::new_glean; use crate::util::truncate_string_at_boundary; - use crate::ErrorType; use crate::Lifetime; #[test] diff --git a/third_party/rust/glean-core/src/metrics/time_unit.rs b/third_party/rust/glean-core/src/metrics/time_unit.rs index 6d61a8a242..6c68d5dff0 100644 --- a/third_party/rust/glean-core/src/metrics/time_unit.rs +++ b/third_party/rust/glean-core/src/metrics/time_unit.rs @@ -2,7 +2,6 @@ // 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::convert::TryFrom; use std::time::Duration; use serde::{Deserialize, Serialize}; diff --git a/third_party/rust/glean-core/src/metrics/timespan.rs b/third_party/rust/glean-core/src/metrics/timespan.rs index ee63fb52f8..d72492a590 100644 --- a/third_party/rust/glean-core/src/metrics/timespan.rs +++ b/third_party/rust/glean-core/src/metrics/timespan.rs @@ -2,7 +2,6 @@ // 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::convert::TryInto; use std::sync::{Arc, RwLock}; use std::time::Duration; diff --git a/third_party/rust/glean-core/src/metrics/timing_distribution.rs b/third_party/rust/glean-core/src/metrics/timing_distribution.rs index 3293be9518..776935afea 100644 --- a/third_party/rust/glean-core/src/metrics/timing_distribution.rs +++ b/third_party/rust/glean-core/src/metrics/timing_distribution.rs @@ -96,7 +96,7 @@ impl TimingDistributionMetric { Self { meta: Arc::new(meta.into()), time_unit, - next_id: Arc::new(AtomicUsize::new(0)), + next_id: Arc::new(AtomicUsize::new(1)), start_times: Arc::new(Mutex::new(Default::default())), } } diff --git a/third_party/rust/glean-core/src/metrics/url.rs b/third_party/rust/glean-core/src/metrics/url.rs index 48b3f9e7ae..0fd5712eeb 100644 --- a/third_party/rust/glean-core/src/metrics/url.rs +++ b/third_party/rust/glean-core/src/metrics/url.rs @@ -168,9 +168,7 @@ impl UrlMetric { #[cfg(test)] mod test { use super::*; - use crate::test_get_num_recorded_errors; use crate::tests::new_glean; - use crate::ErrorType; use crate::Lifetime; #[test] diff --git a/third_party/rust/glean-core/src/storage/mod.rs b/third_party/rust/glean-core/src/storage/mod.rs index 67cb9a1552..a4225e21ed 100644 --- a/third_party/rust/glean-core/src/storage/mod.rs +++ b/third_party/rust/glean-core/src/storage/mod.rs @@ -235,7 +235,7 @@ mod test { fn test_experiments_json_serialization() { let t = tempfile::tempdir().unwrap(); let name = t.path().display().to_string(); - let glean = Glean::with_options(&name, "org.mozilla.glean", true); + let glean = Glean::with_options(&name, "org.mozilla.glean", true, true); let extra: HashMap<String, String> = [("test-key".into(), "test-value".into())] .iter() @@ -264,7 +264,7 @@ mod test { fn test_experiments_json_serialization_empty() { let t = tempfile::tempdir().unwrap(); let name = t.path().display().to_string(); - let glean = Glean::with_options(&name, "org.mozilla.glean", true); + let glean = Glean::with_options(&name, "org.mozilla.glean", true, true); let metric = ExperimentMetric::new(&glean, "some-experiment".to_string()); diff --git a/third_party/rust/glean-core/src/traits/event.rs b/third_party/rust/glean-core/src/traits/event.rs index aa84699b30..ba8c0e5609 100644 --- a/third_party/rust/glean-core/src/traits/event.rs +++ b/third_party/rust/glean-core/src/traits/event.rs @@ -3,7 +3,6 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. use std::collections::HashMap; -use std::convert::TryFrom; use std::hash::Hash; use crate::event_database::RecordedEvent; diff --git a/third_party/rust/glean-core/src/upload/directory.rs b/third_party/rust/glean-core/src/upload/directory.rs index 706550fe6c..91a4d061d1 100644 --- a/third_party/rust/glean-core/src/upload/directory.rs +++ b/third_party/rust/glean-core/src/upload/directory.rs @@ -317,8 +317,6 @@ impl PingDirectoryManager { #[cfg(test)] mod test { - use std::fs::File; - use super::*; use crate::metrics::PingType; use crate::tests::new_glean; diff --git a/third_party/rust/glean-core/src/upload/mod.rs b/third_party/rust/glean-core/src/upload/mod.rs index e51a9d9508..f217137f00 100644 --- a/third_party/rust/glean-core/src/upload/mod.rs +++ b/third_party/rust/glean-core/src/upload/mod.rs @@ -14,7 +14,6 @@ use std::collections::HashMap; use std::collections::VecDeque; -use std::convert::TryInto; use std::path::PathBuf; use std::sync::atomic::{AtomicBool, AtomicU32, Ordering}; use std::sync::{Arc, RwLock, RwLockWriteGuard}; @@ -856,9 +855,6 @@ pub fn chunked_log_info(_path: &str, payload: &str) { #[cfg(test)] mod test { - use std::thread; - use std::time::Duration; - use uuid::Uuid; use super::*; diff --git a/third_party/rust/glean-core/src/upload/request.rs b/third_party/rust/glean-core/src/upload/request.rs index b4ac6eba97..6f3b0c0e5c 100644 --- a/third_party/rust/glean-core/src/upload/request.rs +++ b/third_party/rust/glean-core/src/upload/request.rs @@ -8,7 +8,7 @@ use std::collections::HashMap; use chrono::prelude::{DateTime, Utc}; use flate2::{read::GzDecoder, write::GzEncoder, Compression}; -use serde_json::{self, Value as JsonValue}; +use serde_json::Value as JsonValue; use std::io::prelude::*; use crate::error::{ErrorKind, Result}; diff --git a/third_party/rust/glean-core/tests/common/mod.rs b/third_party/rust/glean-core/tests/common/mod.rs index ebc4f14045..cbc6201d02 100644 --- a/third_party/rust/glean-core/tests/common/mod.rs +++ b/third_party/rust/glean-core/tests/common/mod.rs @@ -63,6 +63,7 @@ pub fn new_glean(tempdir: Option<tempfile::TempDir>) -> (Glean, tempfile::TempDi rate_limit: None, enable_event_timestamps: false, experimentation_id: None, + enable_internal_pings: true, }; let glean = Glean::new(cfg).unwrap(); diff --git a/third_party/rust/glean-core/tests/event.rs b/third_party/rust/glean-core/tests/event.rs index c83e225ca2..48120956d7 100644 --- a/third_party/rust/glean-core/tests/event.rs +++ b/third_party/rust/glean-core/tests/event.rs @@ -481,6 +481,7 @@ fn with_event_timestamps() { rate_limit: None, enable_event_timestamps: true, experimentation_id: None, // Enabling event timestamps + enable_internal_pings: true, }; let glean = Glean::new(cfg).unwrap(); diff --git a/third_party/rust/glean-core/tests/ping_maker.rs b/third_party/rust/glean-core/tests/ping_maker.rs index bc3aac6311..f716dc4692 100644 --- a/third_party/rust/glean-core/tests/ping_maker.rs +++ b/third_party/rust/glean-core/tests/ping_maker.rs @@ -91,6 +91,7 @@ fn test_metrics_must_report_experimentation_id() { rate_limit: None, enable_event_timestamps: true, experimentation_id: Some("test-experimentation-id".to_string()), + enable_internal_pings: true, }) .unwrap(); let ping_maker = PingMaker::new(); @@ -143,6 +144,7 @@ fn experimentation_id_is_removed_if_send_if_empty_is_false() { rate_limit: None, enable_event_timestamps: true, experimentation_id: Some("test-experimentation-id".to_string()), + enable_internal_pings: true, }) .unwrap(); let ping_maker = PingMaker::new(); |