tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 71aa2cb3d4ad2bb7d41f70f12468f4de3ab68b18
parent 6041256f2d01c6ea653b6760acf9012a6cd6be73
Author: Jan-Erik Rediger <jrediger@mozilla.com>
Date:   Fri, 24 Oct 2025 12:39:27 +0000

Bug 1991891 - Update to Glean v66.0.0 r=TravisLong,supply-chain-reviewers,mach-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D269369

Diffstat:
MCargo.lock | 12++++++------
MCargo.toml | 2+-
Mgfx/wr/Cargo.lock | 12++++++------
Mgfx/wr/Cargo.toml | 2+-
Mgfx/wr/webrender/Cargo.toml | 2+-
Mgfx/wr/webrender_api/Cargo.toml | 2+-
Mgradle/libs.versions.toml | 2+-
Mpython/sites/mach.txt | 2+-
Msupply-chain/imports.lock | 12++++++------
Mthird_party/rust/glean-core/.cargo-checksum.json | 4++--
Mthird_party/rust/glean-core/Cargo.lock | 18+++++++++---------
Mthird_party/rust/glean-core/Cargo.toml | 6+++---
Mthird_party/rust/glean-core/src/database/mod.rs | 4++--
Mthird_party/rust/glean-core/src/histogram/exponential.rs | 10+++++++++-
Mthird_party/rust/glean-core/src/histogram/linear.rs | 8+++++++-
Mthird_party/rust/glean-core/src/histogram/mod.rs | 14+-------------
Mthird_party/rust/glean-core/src/lib.rs | 12+++++++++---
Mthird_party/rust/glean-core/src/metrics/boolean.rs | 3++-
Mthird_party/rust/glean-core/src/metrics/counter.rs | 4+++-
Mthird_party/rust/glean-core/src/metrics/custom_distribution.rs | 4+++-
Mthird_party/rust/glean-core/src/metrics/datetime.rs | 4+++-
Mthird_party/rust/glean-core/src/metrics/denominator.rs | 4+++-
Mthird_party/rust/glean-core/src/metrics/dual_labeled_counter.rs | 4+++-
Mthird_party/rust/glean-core/src/metrics/event.rs | 4+++-
Mthird_party/rust/glean-core/src/metrics/labeled.rs | 6++++--
Mthird_party/rust/glean-core/src/metrics/memory_distribution.rs | 4+++-
Mthird_party/rust/glean-core/src/metrics/mod.rs | 7+++++--
Mthird_party/rust/glean-core/src/metrics/numerator.rs | 4+++-
Mthird_party/rust/glean-core/src/metrics/object.rs | 4+++-
Mthird_party/rust/glean-core/src/metrics/quantity.rs | 4+++-
Mthird_party/rust/glean-core/src/metrics/rate.rs | 4+++-
Mthird_party/rust/glean-core/src/metrics/string.rs | 4+++-
Mthird_party/rust/glean-core/src/metrics/string_list.rs | 4+++-
Mthird_party/rust/glean-core/src/metrics/text.rs | 4+++-
Mthird_party/rust/glean-core/src/metrics/timespan.rs | 7++++---
Mthird_party/rust/glean-core/src/metrics/timing_distribution.rs | 10++++++----
Mthird_party/rust/glean-core/src/metrics/url.rs | 4+++-
Mthird_party/rust/glean-core/src/metrics/uuid.rs | 4+++-
Mthird_party/rust/glean-core/src/traits/boolean.rs | 2+-
Mthird_party/rust/glean-core/src/traits/counter.rs | 2+-
Mthird_party/rust/glean-core/src/traits/custom_distribution.rs | 2+-
Mthird_party/rust/glean-core/src/traits/datetime.rs | 2+-
Mthird_party/rust/glean-core/src/traits/dual_labeled_counter.rs | 2+-
Mthird_party/rust/glean-core/src/traits/event.rs | 17++---------------
Mthird_party/rust/glean-core/src/traits/memory_distribution.rs | 2+-
Mthird_party/rust/glean-core/src/traits/numerator.rs | 2+-
Mthird_party/rust/glean-core/src/traits/quantity.rs | 2+-
Mthird_party/rust/glean-core/src/traits/rate.rs | 2+-
Mthird_party/rust/glean-core/src/traits/string.rs | 2+-
Mthird_party/rust/glean-core/src/traits/string_list.rs | 2+-
Mthird_party/rust/glean-core/src/traits/text.rs | 2+-
Mthird_party/rust/glean-core/src/traits/timespan.rs | 2+-
Mthird_party/rust/glean-core/src/traits/timing_distribution.rs | 2+-
Mthird_party/rust/glean-core/src/traits/url.rs | 2+-
Mthird_party/rust/glean-core/src/traits/uuid.rs | 2+-
Mthird_party/rust/glean-core/src/upload/mod.rs | 2+-
Mthird_party/rust/glean/.cargo-checksum.json | 4++--
Mthird_party/rust/glean/Cargo.lock | 22+++++++++++-----------
Mthird_party/rust/glean/Cargo.toml | 8++++++--
Mthird_party/rust/glean/src/private/event.rs | 26+++++++++++++++++++++-----
Mthird_party/rust/glean/src/private/object.rs | 4+++-
Mthird_party/rust/glean/src/test.rs | 73+------------------------------------------------------------------------
Athird_party/rust/glean/tests/signaling_done.rs | 104+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mthird_party/rust/zeitstempel/.cargo-checksum.json | 4++--
Mthird_party/rust/zeitstempel/Cargo.lock | 2+-
Mthird_party/rust/zeitstempel/Cargo.toml | 7+++++--
Mthird_party/rust/zeitstempel/README.md | 20+++++++++++++++-----
Mthird_party/rust/zeitstempel/src/fallback.rs | 16++++++++++++++++
Mthird_party/rust/zeitstempel/src/lib.rs | 61++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
Mthird_party/rust/zeitstempel/src/linux.rs | 19+++++++++++++++++++
Mthird_party/rust/zeitstempel/src/mac.rs | 10++++++++++
Mthird_party/rust/zeitstempel/src/win.rs | 15++++++++++++++-
Mthird_party/rust/zeitstempel/src/win10.rs | 16+++++++++++-----
73 files changed, 451 insertions(+), 232 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -2713,9 +2713,9 @@ dependencies = [ [[package]] name = "glean" -version = "65.2.2" +version = "66.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "895946f5a54f9d54c24175af3a064c9ecf8b4f9374afb26132b583f179fc6be2" +checksum = "3acc348bbf540abeedf7c271daf952b1e24311e2ea1c1f8ac172a5cedf37ac91" dependencies = [ "crossbeam-channel", "glean-core", @@ -2728,9 +2728,9 @@ dependencies = [ [[package]] name = "glean-core" -version = "65.2.2" +version = "66.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b22a5ae2c3fd542fb8388da0de68542748f466c8df9a815c8b9cc274894ab919" +checksum = "540e40007a01e43b73904d1ee8f7efd4782f1a7f4a20ef1dd6d2c00fc18d54b6" dependencies = [ "android_logger", "bincode", @@ -8311,9 +8311,9 @@ dependencies = [ [[package]] name = "zeitstempel" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94652f036694517fa67509942c3b60a51a19e1cd9cfd0f456eeb830ae8798d3d" +checksum = "f523a0d9326c4f3242ad3a9d306baa7fe4572fd532cc891cabecfb714c786c1e" dependencies = [ "cfg-if", "libc", diff --git a/Cargo.toml b/Cargo.toml @@ -72,7 +72,7 @@ uniffi_pipeline = "0.29.3" # Shared across multiple application-services consumers. rusqlite = "0.37" # Shared across multiple glean consumers. -glean = "=65.2.2" +glean = "=66.0.0" # Explicitly specify what our profiles use. The opt-level setting here is # a total fiction; see the setup of MOZ_RUST_DEFAULT_FLAGS for what the diff --git a/gfx/wr/Cargo.lock b/gfx/wr/Cargo.lock @@ -1232,9 +1232,9 @@ dependencies = [ [[package]] name = "glean" -version = "65.2.2" +version = "66.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "895946f5a54f9d54c24175af3a064c9ecf8b4f9374afb26132b583f179fc6be2" +checksum = "3acc348bbf540abeedf7c271daf952b1e24311e2ea1c1f8ac172a5cedf37ac91" dependencies = [ "crossbeam-channel", "glean-core", @@ -1247,9 +1247,9 @@ dependencies = [ [[package]] name = "glean-core" -version = "65.2.2" +version = "66.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b22a5ae2c3fd542fb8388da0de68542748f466c8df9a815c8b9cc274894ab919" +checksum = "540e40007a01e43b73904d1ee8f7efd4782f1a7f4a20ef1dd6d2c00fc18d54b6" dependencies = [ "android_logger", "bincode", @@ -4280,9 +4280,9 @@ dependencies = [ [[package]] name = "zeitstempel" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94652f036694517fa67509942c3b60a51a19e1cd9cfd0f456eeb830ae8798d3d" +checksum = "f523a0d9326c4f3242ad3a9d306baa7fe4572fd532cc891cabecfb714c786c1e" dependencies = [ "cfg-if 1.0.0", "libc", diff --git a/gfx/wr/Cargo.toml b/gfx/wr/Cargo.toml @@ -10,7 +10,7 @@ resolver = "2" [workspace.dependencies] gleam = "0.15.1" -glean = "=65.2.2" +glean = "=66.0.0" [profile.release] debug = true diff --git a/gfx/wr/webrender/Cargo.toml b/gfx/wr/webrender/Cargo.toml @@ -58,7 +58,7 @@ swgl = { path = "../swgl", optional = true } topological-sort = "0.1" peek-poke = { version = "0.3", path = "../peek-poke" } allocator-api2 = { version = "0.2.18", features = ["alloc", "serde"] } -zeitstempel = "0.1.2" +zeitstempel = "0.2.0" hyper = { version = "0.14.32", optional = true, features = ["server", "http1", "tcp", "stream"] } tokio = { version = "1", optional = true, features = ["rt-multi-thread", "net", "io-util"] } serde_json = { optional=true, version="1" } diff --git a/gfx/wr/webrender_api/Cargo.toml b/gfx/wr/webrender_api/Cargo.toml @@ -26,4 +26,4 @@ serde_bytes = "0.11" malloc_size_of = { version = "0.2.0", path = "../wr_malloc_size_of", package = "wr_malloc_size_of" } peek-poke = { version = "0.3", path = "../peek-poke", features = ["extras"] } crossbeam-channel = "0.5" -zeitstempel = "0.1.2" +zeitstempel = "0.2.0" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml @@ -76,7 +76,7 @@ ktlint = "1.7.1" spotless = "8.0.0" # Mozilla -glean = "65.2.2" +glean = "66.0.0" # Testing libraries androidx-test = "1.7.0" diff --git a/python/sites/mach.txt b/python/sites/mach.txt @@ -57,7 +57,7 @@ pth:xpcom/geckoprocesstypes_generator pth:xpcom/idl-parser # glean-sdk may not be installable if a wheel isn't available # and it has to be built from source. -pypi-optional:glean-sdk==65.2.2:telemetry will not be collected +pypi-optional:glean-sdk==66.0.0:telemetry will not be collected pypi-optional:orjson>=3.10.15:json operations will be slower in various tools # Mach gracefully handles the case where `psutil` is unavailable. # We aren't (yet) able to pin packages in automation, so we have to diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock @@ -261,15 +261,15 @@ user-login = "jrmuizel" user-name = "Jeff Muizelaar" [[publisher.glean]] -version = "65.2.2" -when = "2025-10-02" +version = "66.0.0" +when = "2025-10-21" user-id = 48 user-login = "badboy" user-name = "Jan-Erik Rediger" [[publisher.glean-core]] -version = "65.2.2" -when = "2025-10-02" +version = "66.0.0" +when = "2025-10-21" user-id = 48 user-login = "badboy" user-name = "Jan-Erik Rediger" @@ -957,8 +957,8 @@ user-id = 73222 user-login = "wasmtime-publish" [[publisher.zeitstempel]] -version = "0.1.2" -when = "2025-07-22" +version = "0.2.0" +when = "2025-10-06" user-id = 48 user-login = "badboy" user-name = "Jan-Erik Rediger" diff --git a/third_party/rust/glean-core/.cargo-checksum.json b/third_party/rust/glean-core/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.lock":"cb4157ee7dbc00995c9b8fe1e762e7bf955cb3fdd6f826990494e340e0b21b57","Cargo.toml":"c806ecada5be56fd1c8e2578a5c8fe53e3526479a1fd94fe1ac6c11974c179ec","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"026495898699b54608eb4ec16074ffafc57920d80ccb59961c501a1ea28c9985","build.rs":"4857bea99c6b8c08db8818efa9d3738716f52d3acb68159323957ae52892a3eb","examples/rkv-open.rs":"0d0aaaa29b47338880ab444cece0dfa212ff114cbaf738c9a4cd6e7f10545854","src/common_metric_data.rs":"571075e47241a5f21799994033f852d0d70d0e486661287646ac61dadd11ac59","src/core/mod.rs":"14141b42926a91ec4924e7246f3b891508a63bd1750330c4ad2198674b4d7d7d","src/core_metrics.rs":"ddc750e9f4e11f88aee947360897031657aeef74fcf0f3293bd9033b78747354","src/coverage.rs":"49613fd310bd24d779472720975fbe6c97ec370a95eb55f10afa43f67539c942","src/database/mod.rs":"d7326c8820748f92d101c7978f77064010a7475dfea508b5817c201c6ec2b9a8","src/debug.rs":"663f77a3335256a562afad031496ea9215e315edd608398452df514dcff0b4af","src/dispatcher/global.rs":"17493b1a5e926ca1e9c1cda2ee031773402a19183911eb80048630d60266d89e","src/dispatcher/mod.rs":"30086e2aa8b34d7bdeef6ca93c115f3f22c438dc7a9896ce8251c9e6992420ea","src/error.rs":"b93c7d3e243b21bb9eafc95f17860aba1a942b2f2b0a7f43307690f05fece516","src/error_recording.rs":"32c1f58ff080cb22184bca37e356faadbfe846386880fb0898b773adb3a97d8c","src/event_database/mod.rs":"cfd584864a8300a2b441bd91558dcc64ab8130bcc9e19583edeb37a3d9622d2c","src/fd_logger.rs":"0c9def6fa53db1a2ab93c85795f8a7df57797bcfd3978146923e151752e291a6","src/glean.udl":"43d66c7ee56533bdac9f272f3281515ee1e2cc1d9db2c85811f37283acda2967","src/glean_metrics.rs":"eb8dcf95b7a1a5c53d880f0ff791300e6c4c5e21f0761fed7c004381bc43a230","src/histogram/exponential.rs":"63c81371f3c912f946dd39aea76f6f3f73f35f1526110b7def4c2badab48143d","src/histogram/functional.rs":"fffa12a5b2b376cf9337ee0fdd6ad7961841e441b556a4e9ef29c524f933ea2d","src/histogram/linear.rs":"7531e1515844fca96f7c9dad48f632012d9d2bc002f02c15c82501c74c324e70","src/histogram/mod.rs":"0dd7264a04da0bb69aed42bc99201ef0d4d7be8ea1503165fd2904440e805ad5","src/internal_metrics.rs":"ed17121170c203062a9a8f0debb1da8caef49056e1a54096f53ffc3be7571075","src/internal_pings.rs":"308a0437325686cdbc7b7ed2f444a972e76a06d3982c4d9551324f8e21e96a23","src/lib.rs":"490e8c7374e64684113bae1f1d1c0ddaf08bc53df9ac474d864f91d8adf2bd59","src/lib_unit_tests.rs":"cc0ca9d21ce75fc9e8b445240d770018459b8f71f44b08a988d4ac2d25ac3c4f","src/metrics/boolean.rs":"0d3b3ab535a30fe2de3709c21b0f56d294171aa748d7fca9b022f59504055f4c","src/metrics/counter.rs":"31e52181aed062b686ec0dc745ead3946ce685ca49c2f90733aa3054a46ee428","src/metrics/custom_distribution.rs":"c8e3843a618eda50d2702ec3438ba89cb8132503f288cc91765fb9eca410f3cf","src/metrics/datetime.rs":"f03b9c8c97c14d6d34e0a019730fb71a7d8dd1cd929c17817c40ee84f12a53f4","src/metrics/denominator.rs":"0cda6120020b5bec89804e8700b8eb4e22cc85550f64612a6dbf403aea5fa1fd","src/metrics/dual_labeled_counter.rs":"81c6b668cd75e6eb3383bfeff569b9aca98f7f0cf4d75a528162e2e0810ba16b","src/metrics/event.rs":"412b5ed7703b0a8edcf33c344a09c7277141d924898397b18891d02ccba7730d","src/metrics/experiment.rs":"5f9278cca4e133eb8df33bbfe36d1fe0ef3eade8c09f1b46db3c4d0790515412","src/metrics/labeled.rs":"5e1b4df1086f10013794db27d19050792e8929f97e61cd9bd738e1944df7b940","src/metrics/memory_distribution.rs":"2d8c79148585792477a4242132aa4d39f6ed384e533b9fc7b629df0cda21e0dc","src/metrics/memory_unit.rs":"ee32e020cb303dd631457374048a3ed53a2e7cbacc29c54d17d836fb15507538","src/metrics/mod.rs":"27b2f2931c942d8007cf0e4acbc8c875c2a08761b886c04b58c3d6b6b7d726d3","src/metrics/numerator.rs":"d9a8f1bfb846746eab9fca3cdbb58a679f1a16f7c192bacb46697766eb33c9ce","src/metrics/object.rs":"93a17838f0e845a2ffccef63adde28629aea25453dc5bfb742dde3dfd956d13b","src/metrics/ping.rs":"6eef8ca063adb1158a66bf283fa66c2349e1551366b1f027150a45f24025b364","src/metrics/quantity.rs":"0e722d6e2b5f215815b45de85697ca3513a0c22768e802acbacee2e09914de2e","src/metrics/rate.rs":"2c217d6b1b1094cdf72ffd55b90823e535094d422714cdc3c98339fa2a0509d8","src/metrics/recorded_experiment.rs":"6f089534bb4e1143abf0aa43e813c9fcc864fff128a825e83f09e61e96a1f6ee","src/metrics/remote_settings_config.rs":"3beea00afd2779f1e4d2d88ed43cbce1e5a62286ea74b52f0a62236f3b34c217","src/metrics/string.rs":"8d218d13508bac5d384caaccd1e83f16e31c470a7276ae14685767196892b008","src/metrics/string_list.rs":"a01360c198d9505158757b42bf3fa14cadbee825d2f261b96778eb70b89c5902","src/metrics/text.rs":"18c81d0c049d1c92c4d22ccb534cae944a0f190872b4dfc2788e9a7ed0eff2d0","src/metrics/time_unit.rs":"72325065e4ac0f3562f1983bda9fe3c0ab18272011dafe03d67900a3184a8eb6","src/metrics/timespan.rs":"5aa05a2540b551794aa64d7cdd253dfacd4f50b78878608adc909185b06f431a","src/metrics/timing_distribution.rs":"6e62c42c345385fd2c0e697603dbe947b41a3ba52beb6df6c604b29316c19e7b","src/metrics/url.rs":"02e7279f71f6ea0b54f6c9732fb4ff8422061963d134ed7f5091a24d0ba74d1b","src/metrics/uuid.rs":"d3fd20143c7fe7462c9ad819bb5e6ae370930a8b30e778d799cfe48a63b35e67","src/ping/mod.rs":"22c85bd40fd0dbf479d504c6b8671833d02fbe2da2d2778fcbb11aeeea5f65b6","src/scheduler.rs":"2463d406492b43e3b4544bc3b6cdeea99421b2bb04178a0cf38cd9cfcd00c5e4","src/storage/mod.rs":"4c7daf0a8252b027577104a553bc5eeaf5a8b008e6109b249ed081c20b5720ea","src/system.rs":"e3d1b54e1d39cafe6f4dc7ff5021b08c879733f909951b0e1332b3efa9ed97bd","src/thread.rs":"f8504fb6cfc7b43566f232930d5075d8a759fd7339d81ff01ba73568298492c7","src/traits/boolean.rs":"772acc7e42b16f1d5ca559009f33f3f2eedd71eec68211d651a41dcadda93267","src/traits/counter.rs":"b5ec577b46c6b78a503fc9f1712e4033c0a17d952c7eb619b5dbdd56cb65bc4f","src/traits/custom_distribution.rs":"17354bd7a9d5add9ffaf66a5d4f3bd7e3a42b33cad24138e30c8b08ecc8d5308","src/traits/datetime.rs":"a917cb631be66e0c42bfa49ca370f862c39497534e38ea9f42f7125a1fe7c280","src/traits/dual_labeled_counter.rs":"9f69fad25d7982f1d5d8195e2d218cebebb22db2c5f913202d25294d3462c254","src/traits/event.rs":"de542d6eb14648524f3ab5bd695767a30a2bb177fc2f297c9bbdc0340543e56d","src/traits/labeled.rs":"1b2f8eea8d59e1635f64993936d880084a5e3f65cfd7a26ddf6968366890187d","src/traits/memory_distribution.rs":"193b3c8aeb7dfd4b87337a9ba36ae9b2774b8f1a9bfe0a59632e0670ff242d8f","src/traits/mod.rs":"1ffab9c66d37a4759c369d805386792eb39f769d6a801e1737eb19cfdb40477f","src/traits/numerator.rs":"27946742ef94e0018de4bb690414ff187fe28e7e845431873bc4ad5981c2d3a9","src/traits/object.rs":"c03bad670ec7affbc578247f9e1904e898c1870b9bf25750c5094113f995623f","src/traits/ping.rs":"8831c106c03afeb458b0b028fa1ce61f056ebf8e82bc0a171a1bff255d920748","src/traits/quantity.rs":"02397ed9542aaca442d5eed3419b33744c5781fffc0d91e57474cb983370cdc1","src/traits/rate.rs":"34c6bf9d718b1f94ef56f03b3b41ecfaf36111a4bee114d3bf17231d8842e772","src/traits/string.rs":"f21cf48c23086c61b6620c65f2e3dea8b83728a25b466f69a194223c5a33f9e5","src/traits/string_list.rs":"2816a6eb8716e0f2fe2383954e9b8f81494bf4dfee4d35c55698795dc1f2be53","src/traits/text.rs":"ef4422b0027e1282d0a9adc5c6c7e852b70151e2619fba4956434a85f1a396f5","src/traits/timespan.rs":"74bfc63448d2cc9b184b4ffa6c9cce962fb5aeac045988face556c4eb58a2ca1","src/traits/timing_distribution.rs":"45c0eda19b799af94b03476edefe086bd870ef0a07fd09c835bf398786d2b605","src/traits/url.rs":"5540515d7ef0949fe17f8bf54fa8c6d2f45ee0579632d7100f35b04d51013c88","src/traits/uuid.rs":"9d4e48de7ccf3e862ec0adba559811885d5cbefe83ca7a962f82815da88233ec","src/upload/directory.rs":"b676a05ae19a937e81391d749048fd7f544c629999dd71c8198319b5534da956","src/upload/mod.rs":"b162abaa982c62fa8f803a5b2b28c9d2d700829212046446667f79f795601b5c","src/upload/policy.rs":"0f8e50db8942b75ca871764e3a250d3d382925f752b162c8ac160185c5f6a2d7","src/upload/request.rs":"6922ca8ca6944b414686234156b1d46bf9e6f4bf745b77ed7a767ad231970876","src/upload/result.rs":"c956266c54595d27d5e8b11abffe28fad5fea82995922618805b66cfdcc21d54","src/util.rs":"8fe16c1a1c89d9ca0fee425d81a5809c999092c0b7543d386a2b9a6d649ba130","tests/boolean.rs":"76d6014ff108cb6514d9bceb1b2b14749a55b09921f4595a5e30f1bd3546e9f0","tests/collection_enabled.rs":"05517ad50a05e97f73b658eb854561284db1588c7f1ec736055436a0b2b64d99","tests/common/mod.rs":"be651c204ea7fc8412959a29d03a5c6ed868e20f8c06733869063dcfb18d8405","tests/counter.rs":"4c59def10e64de0d7a0241dde0267fd02c828b38be8cc67fba90a76004ca6721","tests/custom_distribution.rs":"41c593a0b4561e21f29d1a5b948de964a866253c58ca76ffefebe370fca150e0","tests/datetime.rs":"51bf8ebea3f5b99d2e5cab1d0e2cd15d750a05c5002b9dbec614ce7dc9093cf4","tests/dual_labeled_counter.rs":"e95a5713ec3faa2cbd4bfdafa9b2f4051bb7c3d7e3fd09ca4d730d5ee7d30ffe","tests/event.rs":"2321b9b80460aeaeb3583da5d475de7c6e331e95033f38313a9018056850201b","tests/labeled.rs":"01ea8db75d774f6ca864f7cc772c98c21e570511cb034e0226127a2bae7b605f","tests/memory_distribution.rs":"3d9a5b8f99e03f783e3396e4320ee4dc974c895cfef2cec0b14d2a9a9f9b736f","tests/object.rs":"8c35676e04f6ccf54a28764700915e753fc0355bfa5d7804d72caba66fd564cd","tests/ping.rs":"eff68d3b47b04c58d8123214dd66e8d06d11f82ed3fd4f703224f84effb319bb","tests/ping_maker.rs":"e4b834336dc8114531746a3c47a8c28c7ae9831856c06d9c0ce26a1167e4fcfd","tests/quantity.rs":"55e7dca346fd1d27f0974b78ca3fb12427cb5da2ee637afc08a54f360f947361","tests/rate.rs":"3766230e31cc4ab960f916b4c2f9208cc8542ecea0749298197f547b745440e9","tests/storage.rs":"990dd1d13b9ffa8af0686977a6ac3502c6befb9eaa83649587e2660f51c596c9","tests/string.rs":"397fcfd27c25f0e81e2a40db3265b0d7dc0dd56b190319c1f86cb1c2c0ed4f9d","tests/string_list.rs":"34efa2afe3e89e6635f21ec9c80650d5816e35e9cb85163d894d600a5b3a4e3a","tests/test-rkv-cases.sh":"1df53d64ba03ff60b242afb79099fb1a5847a7d29b4b8f6e3fa8d75bdeff1d71","tests/text.rs":"c3449e0dd8d774a60f47e39752c16951b8723eeea11c6a01d7fa7d3536285773","tests/timespan.rs":"3d05739a93f3e0ea7264e8fdea876bd948714e5b44e82b8fd7c0218fdb597bb3","tests/timing_distribution.rs":"072ad950b2162e503150e411119b9a000573538bd2cff93c1c1a3616d1589ef4","tests/uuid.rs":"e0e58614319f5e973126f5b4e68d9289ccd6d65e428aca215bf7dcc8a0504889","uniffi.toml":"6ddc98b686b0925a81abd9d1c769e5c98ac29771b210a1c535931a46dec9a8e3"},"package":"b22a5ae2c3fd542fb8388da0de68542748f466c8df9a815c8b9cc274894ab919"} -\ No newline at end of file +{"files":{"Cargo.lock":"8593755a9f74ae880223e47bea3a928558c9e99a9d24b3b02787d3dfd77b4a45","Cargo.toml":"7bdf81bfa0a1cf0f840ef231ae5c4e5a5cb136b5db2a8751a4993b558f418cbe","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"026495898699b54608eb4ec16074ffafc57920d80ccb59961c501a1ea28c9985","build.rs":"4857bea99c6b8c08db8818efa9d3738716f52d3acb68159323957ae52892a3eb","examples/rkv-open.rs":"0d0aaaa29b47338880ab444cece0dfa212ff114cbaf738c9a4cd6e7f10545854","src/common_metric_data.rs":"571075e47241a5f21799994033f852d0d70d0e486661287646ac61dadd11ac59","src/core/mod.rs":"14141b42926a91ec4924e7246f3b891508a63bd1750330c4ad2198674b4d7d7d","src/core_metrics.rs":"ddc750e9f4e11f88aee947360897031657aeef74fcf0f3293bd9033b78747354","src/coverage.rs":"49613fd310bd24d779472720975fbe6c97ec370a95eb55f10afa43f67539c942","src/database/mod.rs":"c2de5ea95bbfd828cd3f2943fd7b9125cccbf7de79bb8564970ec2b1782f271a","src/debug.rs":"663f77a3335256a562afad031496ea9215e315edd608398452df514dcff0b4af","src/dispatcher/global.rs":"17493b1a5e926ca1e9c1cda2ee031773402a19183911eb80048630d60266d89e","src/dispatcher/mod.rs":"30086e2aa8b34d7bdeef6ca93c115f3f22c438dc7a9896ce8251c9e6992420ea","src/error.rs":"b93c7d3e243b21bb9eafc95f17860aba1a942b2f2b0a7f43307690f05fece516","src/error_recording.rs":"32c1f58ff080cb22184bca37e356faadbfe846386880fb0898b773adb3a97d8c","src/event_database/mod.rs":"cfd584864a8300a2b441bd91558dcc64ab8130bcc9e19583edeb37a3d9622d2c","src/fd_logger.rs":"0c9def6fa53db1a2ab93c85795f8a7df57797bcfd3978146923e151752e291a6","src/glean.udl":"43d66c7ee56533bdac9f272f3281515ee1e2cc1d9db2c85811f37283acda2967","src/glean_metrics.rs":"eb8dcf95b7a1a5c53d880f0ff791300e6c4c5e21f0761fed7c004381bc43a230","src/histogram/exponential.rs":"036d7ff1d19dc5cda7c491b839565b32901093af4091ec8f3d306495e4116a47","src/histogram/functional.rs":"fffa12a5b2b376cf9337ee0fdd6ad7961841e441b556a4e9ef29c524f933ea2d","src/histogram/linear.rs":"ef77f6a3177f9fb474b68392eab3b308ab9ec7f3ffc3d7e75939927f5939cff6","src/histogram/mod.rs":"b4033298bdd011542cf4243a4f64634b4b9b815aa0a7c2c662a55310298dab5e","src/internal_metrics.rs":"ed17121170c203062a9a8f0debb1da8caef49056e1a54096f53ffc3be7571075","src/internal_pings.rs":"308a0437325686cdbc7b7ed2f444a972e76a06d3982c4d9551324f8e21e96a23","src/lib.rs":"59074e53a3b670577da34a5a95d5f7a7b638cef3f7957a1c3c10901dd6e77b69","src/lib_unit_tests.rs":"cc0ca9d21ce75fc9e8b445240d770018459b8f71f44b08a988d4ac2d25ac3c4f","src/metrics/boolean.rs":"06c6f4a7c236083f95f3a9f2bc543aa2745f8d02d25bd2dee0dfe37ca2558662","src/metrics/counter.rs":"5cdebb985fc960283926f96d2e08b9e72a70c5d6e5e27463671a64d8eb532d84","src/metrics/custom_distribution.rs":"2801f3bb298df1ef306dee05baf03e29deb4d3d6bd8328deeb3d34bd337e4fff","src/metrics/datetime.rs":"f38db0aae52dd2eba726b76a9a246c70e15ed9dc303c3d1df33229b9fdc3826b","src/metrics/denominator.rs":"69403002f65cf6c2a792c17f1714e4841a44283e3df19704b84cd46554a4bd21","src/metrics/dual_labeled_counter.rs":"c2fa7faff470b0d78c1abfb17a6983a2a4f13ef9004430fa6649fe2ba0485f68","src/metrics/event.rs":"f79103475b656b631861431e7b943956d94b1a92621f2e05d6fbca0312673c20","src/metrics/experiment.rs":"5f9278cca4e133eb8df33bbfe36d1fe0ef3eade8c09f1b46db3c4d0790515412","src/metrics/labeled.rs":"6bab38ccd297f92b54b91f6a36c39a9eaecf7573f6f761850c467e605cd0dd2b","src/metrics/memory_distribution.rs":"681ee0a15ebdd7d7f81edac0ef7e8f1e7bb0eb45414b4a95a8c33b9f215ac444","src/metrics/memory_unit.rs":"ee32e020cb303dd631457374048a3ed53a2e7cbacc29c54d17d836fb15507538","src/metrics/mod.rs":"63bbefcc54b22a066a14da6850b3a7f6c8aea2102e64678d84c66bb65f682e5d","src/metrics/numerator.rs":"de8853a691980606745895c083c22036347117b3d556de66a9d9978ec0f51168","src/metrics/object.rs":"cae8f118350e5fd7d28a810ac8d00ba7e401237f3e4fbb6233eef3874ddf8683","src/metrics/ping.rs":"6eef8ca063adb1158a66bf283fa66c2349e1551366b1f027150a45f24025b364","src/metrics/quantity.rs":"a39359e4c21ffbe687580eeac02967f12dec85ba0461ac2167a5bbd23ab7b2af","src/metrics/rate.rs":"ffde9ace03310287c7d6624b391c2168571deaf421b7e1e71fe4b771867f6a36","src/metrics/recorded_experiment.rs":"6f089534bb4e1143abf0aa43e813c9fcc864fff128a825e83f09e61e96a1f6ee","src/metrics/remote_settings_config.rs":"3beea00afd2779f1e4d2d88ed43cbce1e5a62286ea74b52f0a62236f3b34c217","src/metrics/string.rs":"6469efc8b42841ad7dd265bb77c9ed187cb175e62e006a47cc46ec677b907715","src/metrics/string_list.rs":"acb68507cddc8f3a6a90abb075d1099fe047603f4af3c776de6fa25fc5893f57","src/metrics/text.rs":"ffb9664d8eadbc858da543d27e11c9a8aff8dadfa98f4b7b92e458a7627c2a48","src/metrics/time_unit.rs":"72325065e4ac0f3562f1983bda9fe3c0ab18272011dafe03d67900a3184a8eb6","src/metrics/timespan.rs":"028245d298c800a877f614bd8832fb596ff11ea600d4e00b4967c127cbb48994","src/metrics/timing_distribution.rs":"30af0e8417176b5ec3136bbefe699e3ec7c342c0a14dac3b27f35d2b55d853b7","src/metrics/url.rs":"3efa62c1c1070319f56fb641d61f489918d716763916dcd6d6d3073b3a6f8c6f","src/metrics/uuid.rs":"3b18c899d2c1e5967b73594dd2a0ab6f2b0c220eaf2bf3d4ef7de2cb1c1e4edd","src/ping/mod.rs":"22c85bd40fd0dbf479d504c6b8671833d02fbe2da2d2778fcbb11aeeea5f65b6","src/scheduler.rs":"2463d406492b43e3b4544bc3b6cdeea99421b2bb04178a0cf38cd9cfcd00c5e4","src/storage/mod.rs":"4c7daf0a8252b027577104a553bc5eeaf5a8b008e6109b249ed081c20b5720ea","src/system.rs":"e3d1b54e1d39cafe6f4dc7ff5021b08c879733f909951b0e1332b3efa9ed97bd","src/thread.rs":"f8504fb6cfc7b43566f232930d5075d8a759fd7339d81ff01ba73568298492c7","src/traits/boolean.rs":"fa955e81ee0ff1a3da86002347cf4713f4ccd4e7a32ecddc7e8eab6483820277","src/traits/counter.rs":"8ed21fad9163b10a4fec89c052437ada69bbda6c9fe9e912bd9a2531a3264427","src/traits/custom_distribution.rs":"6934948c7ca72d42d093f424ccfa6de7fef4b7b17a838c942ed6c4aa94cf222b","src/traits/datetime.rs":"6c3bae9b7e971181c4d0c39d873a424b4bd30bdab3dc9fd00027327902f628fd","src/traits/dual_labeled_counter.rs":"63cbed60be3e8d695788f0a3624507787a005a0aaf05bdd3828fdfb0890952e0","src/traits/event.rs":"f372bfce1247d59693af351f2d79023c07d4f2f1fbaa38fc0bdce1af6d218bb5","src/traits/labeled.rs":"1b2f8eea8d59e1635f64993936d880084a5e3f65cfd7a26ddf6968366890187d","src/traits/memory_distribution.rs":"9e559d2579092062da945ec1d901439b3907fdc9db2bb376b10f9a877b58f2ac","src/traits/mod.rs":"1ffab9c66d37a4759c369d805386792eb39f769d6a801e1737eb19cfdb40477f","src/traits/numerator.rs":"d5991ef6463d17127ce7c969f8a3e110ec83b59714162f04d371ac43844241a1","src/traits/object.rs":"c03bad670ec7affbc578247f9e1904e898c1870b9bf25750c5094113f995623f","src/traits/ping.rs":"8831c106c03afeb458b0b028fa1ce61f056ebf8e82bc0a171a1bff255d920748","src/traits/quantity.rs":"cff0f7fdd0ee41d0457d9ca08222f652b4649eb64e0c0fbdfa76849013012c56","src/traits/rate.rs":"4f0a3a68d78631e5d5b83cbc65bfb9a41359b4fd8874296d58adebbc914a739a","src/traits/string.rs":"594a330ca03b21128040a263b3d4c85f66aed5147ac785f036f8c537c691dfd3","src/traits/string_list.rs":"b0b46bdf8c48a7480a0144eb40bf93fbfd8086af8e5f73863676fb695fb443ba","src/traits/text.rs":"b700031c6204126e73d9ea9c36f59fe6eb0b3b5dc50696072445c4420806f80f","src/traits/timespan.rs":"95d747ade6a58428f613b8860289a369386f45a8dc2b76ba741e39cbf19cc438","src/traits/timing_distribution.rs":"20e3ff9eed201a782f35584c657af0c7430673a97afeae708e2ea893a5723b95","src/traits/url.rs":"36fa73762288c4d33dd72de1a47c1f5451d2d6e751cf293d5e0ec88ebd4f9a71","src/traits/uuid.rs":"ea31080e349166d59272a119a546870650fab3dc512d356efbc98a3254165023","src/upload/directory.rs":"b676a05ae19a937e81391d749048fd7f544c629999dd71c8198319b5534da956","src/upload/mod.rs":"0cabe040aa8711c419922bd2e00acf8e3d3af48a65f01c8be590316b957e876a","src/upload/policy.rs":"0f8e50db8942b75ca871764e3a250d3d382925f752b162c8ac160185c5f6a2d7","src/upload/request.rs":"6922ca8ca6944b414686234156b1d46bf9e6f4bf745b77ed7a767ad231970876","src/upload/result.rs":"c956266c54595d27d5e8b11abffe28fad5fea82995922618805b66cfdcc21d54","src/util.rs":"8fe16c1a1c89d9ca0fee425d81a5809c999092c0b7543d386a2b9a6d649ba130","tests/boolean.rs":"76d6014ff108cb6514d9bceb1b2b14749a55b09921f4595a5e30f1bd3546e9f0","tests/collection_enabled.rs":"05517ad50a05e97f73b658eb854561284db1588c7f1ec736055436a0b2b64d99","tests/common/mod.rs":"be651c204ea7fc8412959a29d03a5c6ed868e20f8c06733869063dcfb18d8405","tests/counter.rs":"4c59def10e64de0d7a0241dde0267fd02c828b38be8cc67fba90a76004ca6721","tests/custom_distribution.rs":"41c593a0b4561e21f29d1a5b948de964a866253c58ca76ffefebe370fca150e0","tests/datetime.rs":"51bf8ebea3f5b99d2e5cab1d0e2cd15d750a05c5002b9dbec614ce7dc9093cf4","tests/dual_labeled_counter.rs":"e95a5713ec3faa2cbd4bfdafa9b2f4051bb7c3d7e3fd09ca4d730d5ee7d30ffe","tests/event.rs":"2321b9b80460aeaeb3583da5d475de7c6e331e95033f38313a9018056850201b","tests/labeled.rs":"01ea8db75d774f6ca864f7cc772c98c21e570511cb034e0226127a2bae7b605f","tests/memory_distribution.rs":"3d9a5b8f99e03f783e3396e4320ee4dc974c895cfef2cec0b14d2a9a9f9b736f","tests/object.rs":"8c35676e04f6ccf54a28764700915e753fc0355bfa5d7804d72caba66fd564cd","tests/ping.rs":"eff68d3b47b04c58d8123214dd66e8d06d11f82ed3fd4f703224f84effb319bb","tests/ping_maker.rs":"e4b834336dc8114531746a3c47a8c28c7ae9831856c06d9c0ce26a1167e4fcfd","tests/quantity.rs":"55e7dca346fd1d27f0974b78ca3fb12427cb5da2ee637afc08a54f360f947361","tests/rate.rs":"3766230e31cc4ab960f916b4c2f9208cc8542ecea0749298197f547b745440e9","tests/storage.rs":"990dd1d13b9ffa8af0686977a6ac3502c6befb9eaa83649587e2660f51c596c9","tests/string.rs":"397fcfd27c25f0e81e2a40db3265b0d7dc0dd56b190319c1f86cb1c2c0ed4f9d","tests/string_list.rs":"34efa2afe3e89e6635f21ec9c80650d5816e35e9cb85163d894d600a5b3a4e3a","tests/test-rkv-cases.sh":"1df53d64ba03ff60b242afb79099fb1a5847a7d29b4b8f6e3fa8d75bdeff1d71","tests/text.rs":"c3449e0dd8d774a60f47e39752c16951b8723eeea11c6a01d7fa7d3536285773","tests/timespan.rs":"3d05739a93f3e0ea7264e8fdea876bd948714e5b44e82b8fd7c0218fdb597bb3","tests/timing_distribution.rs":"072ad950b2162e503150e411119b9a000573538bd2cff93c1c1a3616d1589ef4","tests/uuid.rs":"e0e58614319f5e973126f5b4e68d9289ccd6d65e428aca215bf7dcc8a0504889","uniffi.toml":"6ddc98b686b0925a81abd9d1c769e5c98ac29771b210a1c535931a46dec9a8e3"},"package":"540e40007a01e43b73904d1ee8f7efd4782f1a7f4a20ef1dd6d2c00fc18d54b6"} +\ No newline at end of file diff --git a/third_party/rust/glean-core/Cargo.lock b/third_party/rust/glean-core/Cargo.lock @@ -163,9 +163,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "chrono" @@ -316,7 +316,7 @@ dependencies = [ [[package]] name = "glean-core" -version = "65.2.2" +version = "66.0.0" dependencies = [ "android_logger", "bincode", @@ -468,9 +468,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.176" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" [[package]] name = "linux-raw-sys" @@ -547,9 +547,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.2" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "ordered-float" @@ -1230,9 +1230,9 @@ dependencies = [ [[package]] name = "zeitstempel" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94652f036694517fa67509942c3b60a51a19e1cd9cfd0f456eeb830ae8798d3d" +checksum = "f523a0d9326c4f3242ad3a9d306baa7fe4572fd532cc891cabecfb714c786c1e" dependencies = [ "cfg-if", "libc", diff --git a/third_party/rust/glean-core/Cargo.toml b/third_party/rust/glean-core/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.82" name = "glean-core" -version = "65.2.2" +version = "66.0.0" authors = [ "Jan-Erik Rediger <jrediger@mozilla.com>", "The Glean Team <glean-team@mozilla.com>", @@ -40,7 +40,7 @@ license = "MPL-2.0" repository = "https://github.com/mozilla/glean" [package.metadata.glean] -glean-parser = "17.2.0" +glean-parser = "18.0.2" [lib] name = "glean_core" @@ -191,7 +191,7 @@ version = "1.0" features = ["v4"] [dependencies.zeitstempel] -version = "0.1.0" +version = "0.2.0" [dev-dependencies.ctor] version = "0.2.2" diff --git a/third_party/rust/glean-core/src/database/mod.rs b/third_party/rust/glean-core/src/database/mod.rs @@ -526,7 +526,7 @@ impl Database { if let Err(e) = self.record_per_lifetime(data.inner.lifetime, ping_name, &name, value) { - log::error!( + log::info!( "Failed to record metric '{}' into {}: {:?}", data.base_identifier(), ping_name, @@ -597,7 +597,7 @@ impl Database { &name, &mut transform, ) { - log::error!( + log::info!( "Failed to record metric '{}' into {}: {:?}", data.base_identifier(), ping_name, diff --git a/third_party/rust/glean-core/src/histogram/exponential.rs b/third_party/rust/glean-core/src/histogram/exponential.rs @@ -57,7 +57,7 @@ fn exponential_range(min: u64, max: u64, bucket_count: usize) -> Vec<u64> { /// /// Buckets are pre-computed at instantiation with an exponential distribution from `min` to `max` /// and `bucket_count` buckets. -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, MallocSizeOf)] +#[derive(Debug, Clone, Serialize, Deserialize, Eq, MallocSizeOf)] pub struct PrecomputedExponential { // Don't serialize the (potentially large) array of ranges, instead compute them on first // access. @@ -68,6 +68,14 @@ pub struct PrecomputedExponential { pub(crate) bucket_count: usize, } +impl PartialEq for PrecomputedExponential { + fn eq(&self, other: &Self) -> bool { + // `bucket_ranges` are computed on-demand based on `min`, `max` and `bucket_count`, + // so we don't need to compare it (and thus forcing it to be computed) + self.min == other.min && self.max == other.max && self.bucket_count == other.bucket_count + } +} + impl Bucketing for PrecomputedExponential { /// Get the bucket for the sample. /// diff --git a/third_party/rust/glean-core/src/histogram/linear.rs b/third_party/rust/glean-core/src/histogram/linear.rs @@ -37,7 +37,7 @@ fn linear_range(min: u64, max: u64, count: usize) -> Vec<u64> { /// /// Buckets are pre-computed at instantiation with a linear distribution from `min` to `max` /// and `bucket_count` buckets. -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, MallocSizeOf)] +#[derive(Debug, Clone, Serialize, Deserialize, Eq, MallocSizeOf)] pub struct PrecomputedLinear { // Don't serialize the (potentially large) array of ranges, instead compute them on first // access. @@ -48,6 +48,12 @@ pub struct PrecomputedLinear { pub(crate) bucket_count: usize, } +impl PartialEq for PrecomputedLinear { + fn eq(&self, other: &Self) -> bool { + self.min == other.min && self.max == other.max && self.bucket_count == other.bucket_count + } +} + impl Bucketing for PrecomputedLinear { /// Get the bucket for the sample. /// diff --git a/third_party/rust/glean-core/src/histogram/mod.rs b/third_party/rust/glean-core/src/histogram/mod.rs @@ -124,19 +124,7 @@ impl<B: Bucketing> Histogram<B> { /// Gets a snapshot of all values from the first bucket until one past the last filled bucket, /// filling in empty buckets with 0. pub fn snapshot_values(&self) -> HashMap<u64, u64> { - let mut res = self.values.clone(); - - let max_bucket = self.values.keys().max().cloned().unwrap_or(0); - - for &min_bucket in self.bucketing.ranges() { - // Fill in missing entries. - let _ = res.entry(min_bucket).or_insert(0); - // stop one after the last filled bucket - if min_bucket > max_bucket { - break; - } - } - res + self.values.clone() } /// Clear this histogram. diff --git a/third_party/rust/glean-core/src/lib.rs b/third_party/rust/glean-core/src/lib.rs @@ -192,6 +192,12 @@ fn block_on_dispatcher() { dispatcher::block_on_queue() } +/// Returns a timestamp corresponding to "now" with millisecond precision, awake time only. +pub fn get_awake_timestamp_ms() -> u64 { + const NANOS_PER_MILLI: u64 = 1_000_000; + zeitstempel::now_awake() / NANOS_PER_MILLI +} + /// Returns a timestamp corresponding to "now" with millisecond precision. pub fn get_timestamp_ms() -> u64 { const NANOS_PER_MILLI: u64 = 1_000_000; @@ -649,7 +655,7 @@ fn uploader_shutdown() { // * We don't know how long uploads take until we get data from bug 1814592. let result = rx.recv_timeout(Duration::from_secs(30)); - let stop_time = zeitstempel::now(); + let stop_time = zeitstempel::now_awake(); core::with_glean(|glean| { glean .additional_metrics @@ -725,7 +731,7 @@ pub fn shutdown() { let blocked = dispatcher::block_on_queue_timeout(Duration::from_secs(10)); // Always record the dispatcher wait, regardless of the timeout. - let stop_time = zeitstempel::now(); + let stop_time = zeitstempel::now_awake(); core::with_glean(|glean| { glean .additional_metrics @@ -748,7 +754,7 @@ pub fn shutdown() { // Be sure to call this _after_ draining the dispatcher core::with_glean(|glean| { if let Err(e) = glean.persist_ping_lifetime_data() { - log::error!("Can't persist ping lifetime data: {:?}", e); + log::info!("Can't persist ping lifetime data: {:?}", e); } }); } diff --git a/third_party/rust/glean-core/src/metrics/boolean.rs b/third_party/rust/glean-core/src/metrics/boolean.rs @@ -120,7 +120,8 @@ impl BooleanMetric { } } -impl TestGetValue<bool> for BooleanMetric { +impl TestGetValue for BooleanMetric { + type Output = bool; /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently stored value as a boolean. diff --git a/third_party/rust/glean-core/src/metrics/counter.rs b/third_party/rust/glean-core/src/metrics/counter.rs @@ -157,7 +157,9 @@ impl CounterMetric { } } -impl TestGetValue<i32> for CounterMetric { +impl TestGetValue for CounterMetric { + type Output = i32; + /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently stored value as an integer. diff --git a/third_party/rust/glean-core/src/metrics/custom_distribution.rs b/third_party/rust/glean-core/src/metrics/custom_distribution.rs @@ -303,7 +303,9 @@ impl CustomDistributionMetric { } } -impl TestGetValue<DistributionData> for CustomDistributionMetric { +impl TestGetValue for CustomDistributionMetric { + type Output = DistributionData; + /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently stored value as an integer. diff --git a/third_party/rust/glean-core/src/metrics/datetime.rs b/third_party/rust/glean-core/src/metrics/datetime.rs @@ -277,7 +277,9 @@ impl DatetimeMetric { } } -impl TestGetValue<Datetime> for DatetimeMetric { +impl TestGetValue for DatetimeMetric { + type Output = Datetime; + /// **Test-only API (exported for FFI purposes).** /// /// Gets the stored datetime value. diff --git a/third_party/rust/glean-core/src/metrics/denominator.rs b/third_party/rust/glean-core/src/metrics/denominator.rs @@ -127,7 +127,9 @@ impl DenominatorMetric { } } -impl TestGetValue<i32> for DenominatorMetric { +impl TestGetValue for DenominatorMetric { + type Output = i32; + /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently stored value as an integer. diff --git a/third_party/rust/glean-core/src/metrics/dual_labeled_counter.rs b/third_party/rust/glean-core/src/metrics/dual_labeled_counter.rs @@ -231,7 +231,9 @@ impl DualLabeledCounterMetric { } } -impl TestGetValue<HashMap<String, HashMap<String, i32>>> for DualLabeledCounterMetric { +impl TestGetValue for DualLabeledCounterMetric { + type Output = HashMap<String, HashMap<String, i32>>; + fn test_get_value( &self, ping_name: Option<String>, diff --git a/third_party/rust/glean-core/src/metrics/event.rs b/third_party/rust/glean-core/src/metrics/event.rs @@ -212,7 +212,9 @@ impl EventMetric { } } -impl TestGetValue<Vec<RecordedEvent>> for EventMetric { +impl TestGetValue for EventMetric { + type Output = Vec<RecordedEvent>; + /// **Test-only API (exported for FFI purposes).** /// /// Get the vector of currently stored events for this event metric. diff --git a/third_party/rust/glean-core/src/metrics/labeled.rs b/third_party/rust/glean-core/src/metrics/labeled.rs @@ -353,11 +353,13 @@ where } } -impl<T, S> TestGetValue<HashMap<String, S>> for LabeledMetric<T> +impl<T, S> TestGetValue for LabeledMetric<T> where - T: AllowLabeled + TestGetValue<S>, + T: AllowLabeled + TestGetValue<Output = S>, S: Any, { + type Output = HashMap<String, S>; + fn test_get_value(&self, ping_name: Option<String>) -> Option<HashMap<String, S>> { let mut out = HashMap::new(); let map = self.label_map.lock().unwrap(); diff --git a/third_party/rust/glean-core/src/metrics/memory_distribution.rs b/third_party/rust/glean-core/src/metrics/memory_distribution.rs @@ -324,7 +324,9 @@ impl MemoryDistributionMetric { } } -impl TestGetValue<DistributionData> for MemoryDistributionMetric { +impl TestGetValue for MemoryDistributionMetric { + type Output = DistributionData; + /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently stored value. diff --git a/third_party/rust/glean-core/src/metrics/mod.rs b/third_party/rust/glean-core/src/metrics/mod.rs @@ -270,7 +270,10 @@ pub trait MetricIdentifier<'a> { } /// [`TestGetValue`] describes an interface for retrieving the value for a given metric -pub trait TestGetValue<T> { +pub trait TestGetValue { + /// The output type of `test_get_value` + type Output; + /// **Test-only API (exported for FFI purposes).** /// /// Returns the currently stored value of the appropriate type for the given metric. @@ -285,7 +288,7 @@ pub trait TestGetValue<T> { /// # Returns /// /// The stored value or `None` if nothing stored. - fn test_get_value(&self, ping_name: Option<String>) -> Option<T>; + fn test_get_value(&self, ping_name: Option<String>) -> Option<Self::Output>; } // Provide a blanket implementation for MetricIdentifier for all the types diff --git a/third_party/rust/glean-core/src/metrics/numerator.rs b/third_party/rust/glean-core/src/metrics/numerator.rs @@ -76,7 +76,9 @@ impl NumeratorMetric { } } -impl TestGetValue<Rate> for NumeratorMetric { +impl TestGetValue for NumeratorMetric { + type Output = Rate; + /// **Exported for test purposes.** /// /// Gets the currently stored value as a pair of integers. diff --git a/third_party/rust/glean-core/src/metrics/object.rs b/third_party/rust/glean-core/src/metrics/object.rs @@ -151,7 +151,9 @@ impl ObjectMetric { } } -impl TestGetValue<JsonValue> for ObjectMetric { +impl TestGetValue for ObjectMetric { + type Output = JsonValue; + /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently stored value as JSON. diff --git a/third_party/rust/glean-core/src/metrics/quantity.rs b/third_party/rust/glean-core/src/metrics/quantity.rs @@ -152,7 +152,9 @@ impl QuantityMetric { } } -impl TestGetValue<i64> for QuantityMetric { +impl TestGetValue for QuantityMetric { + type Output = i64; + /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently stored value as an integer. diff --git a/third_party/rust/glean-core/src/metrics/rate.rs b/third_party/rust/glean-core/src/metrics/rate.rs @@ -178,7 +178,9 @@ impl RateMetric { } } -impl TestGetValue<Rate> for RateMetric { +impl TestGetValue for RateMetric { + type Output = Rate; + /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently stored value as a pair of integers. diff --git a/third_party/rust/glean-core/src/metrics/string.rs b/third_party/rust/glean-core/src/metrics/string.rs @@ -127,7 +127,9 @@ impl StringMetric { } } -impl TestGetValue<String> for StringMetric { +impl TestGetValue for StringMetric { + type Output = String; + /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently stored value as a string. diff --git a/third_party/rust/glean-core/src/metrics/string_list.rs b/third_party/rust/glean-core/src/metrics/string_list.rs @@ -186,7 +186,9 @@ impl StringListMetric { } } -impl TestGetValue<Vec<String>> for StringListMetric { +impl TestGetValue for StringListMetric { + type Output = Vec<String>; + /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently-stored values. diff --git a/third_party/rust/glean-core/src/metrics/text.rs b/third_party/rust/glean-core/src/metrics/text.rs @@ -131,7 +131,9 @@ impl TextMetric { } } -impl TestGetValue<String> for TextMetric { +impl TestGetValue for TextMetric { + type Output = String; + /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently stored value as a string. diff --git a/third_party/rust/glean-core/src/metrics/timespan.rs b/third_party/rust/glean-core/src/metrics/timespan.rs @@ -56,7 +56,7 @@ impl TimespanMetric { /// [`set_stop`](TimespanMetric::set_stop)): in that case the original start /// time will be preserved. pub fn start(&self) { - let start_time = zeitstempel::now(); + let start_time = zeitstempel::now_awake(); let metric = self.clone(); crate::launch_with_glean(move |glean| metric.set_start(glean, start_time)); @@ -88,7 +88,7 @@ impl TimespanMetric { /// /// This will record an error if no [`set_start`](TimespanMetric::set_start) was called. pub fn stop(&self) { - let stop_time = zeitstempel::now(); + let stop_time = zeitstempel::now_awake(); let metric = self.clone(); crate::launch_with_glean(move |glean| metric.set_stop(glean, stop_time)); @@ -285,7 +285,8 @@ impl TimespanMetric { } } -impl TestGetValue<i64> for TimespanMetric { +impl TestGetValue for TimespanMetric { + type Output = i64; /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently stored value as an integer. diff --git a/third_party/rust/glean-core/src/metrics/timing_distribution.rs b/third_party/rust/glean-core/src/metrics/timing_distribution.rs @@ -153,7 +153,7 @@ impl TimingDistributionMetric { /// /// A unique [`TimerId`] for the new timer. pub fn start(&self) -> TimerId { - let start_time = zeitstempel::now(); + let start_time = zeitstempel::now_awake(); let id = self.next_id.fetch_add(1, Ordering::SeqCst).into(); let metric = self.clone(); crate::launch_with_glean(move |_glean| metric.set_start(id, start_time)); @@ -161,7 +161,7 @@ impl TimingDistributionMetric { } pub(crate) fn start_sync(&self) -> TimerId { - let start_time = zeitstempel::now(); + let start_time = zeitstempel::now_awake(); let id = self.next_id.fetch_add(1, Ordering::SeqCst).into(); let metric = self.clone(); metric.set_start(id, start_time); @@ -192,7 +192,7 @@ impl TimingDistributionMetric { /// same timespan metric. /// * `stop_time` - Timestamp in nanoseconds. pub fn stop_and_accumulate(&self, id: TimerId) { - let stop_time = zeitstempel::now(); + let stop_time = zeitstempel::now_awake(); let metric = self.clone(); crate::launch_with_glean(move |glean| metric.set_stop_and_accumulate(glean, id, stop_time)); } @@ -613,7 +613,9 @@ impl TimingDistributionMetric { } } -impl TestGetValue<DistributionData> for TimingDistributionMetric { +impl TestGetValue for TimingDistributionMetric { + type Output = DistributionData; + /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently stored value as an integer. diff --git a/third_party/rust/glean-core/src/metrics/url.rs b/third_party/rust/glean-core/src/metrics/url.rs @@ -146,7 +146,9 @@ impl UrlMetric { } } -impl TestGetValue<String> for UrlMetric { +impl TestGetValue for UrlMetric { + type Output = String; + /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently stored value as a string. diff --git a/third_party/rust/glean-core/src/metrics/uuid.rs b/third_party/rust/glean-core/src/metrics/uuid.rs @@ -145,7 +145,9 @@ impl UuidMetric { } } -impl TestGetValue<String> for UuidMetric { +impl TestGetValue for UuidMetric { + type Output = String; + /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently stored value as a string. diff --git a/third_party/rust/glean-core/src/traits/boolean.rs b/third_party/rust/glean-core/src/traits/boolean.rs @@ -8,7 +8,7 @@ use crate::{ErrorType, TestGetValue}; /// /// When changing this trait, make sure all the operations are /// implemented in the related type in `../metrics/`. -pub trait Boolean: TestGetValue<bool> { +pub trait Boolean: TestGetValue<Output = bool> { /// Sets to the specified boolean value. /// /// # Arguments diff --git a/third_party/rust/glean-core/src/traits/counter.rs b/third_party/rust/glean-core/src/traits/counter.rs @@ -8,7 +8,7 @@ use crate::{ErrorType, TestGetValue}; /// /// When changing this trait, make sure all the operations are /// implemented in the related type in `../metrics/`. -pub trait Counter: TestGetValue<i32> { +pub trait Counter: TestGetValue<Output = i32> { /// Increases the counter by `amount`. /// /// # Arguments diff --git a/third_party/rust/glean-core/src/traits/custom_distribution.rs b/third_party/rust/glean-core/src/traits/custom_distribution.rs @@ -9,7 +9,7 @@ use crate::{DistributionData, ErrorType, TestGetValue}; /// /// When changing this trait, make sure all the operations are /// implemented in the related type in `../metrics/`. -pub trait CustomDistribution: TestGetValue<DistributionData> { +pub trait CustomDistribution: TestGetValue<Output = DistributionData> { /// Accumulates the provided signed samples in the metric. /// /// This is required so that the platform-specific code can provide us with diff --git a/third_party/rust/glean-core/src/traits/datetime.rs b/third_party/rust/glean-core/src/traits/datetime.rs @@ -10,7 +10,7 @@ use crate::{ErrorType, TestGetValue}; /// /// When changing this trait, make sure all the operations are /// implemented in the related type in `../metrics/`. -pub trait Datetime: TestGetValue<crate::metrics::Datetime> { +pub trait Datetime: TestGetValue<Output = crate::metrics::Datetime> { /// Sets the metric to a date/time which including the timezone offset. /// /// # Arguments diff --git a/third_party/rust/glean-core/src/traits/dual_labeled_counter.rs b/third_party/rust/glean-core/src/traits/dual_labeled_counter.rs @@ -9,7 +9,7 @@ use std::collections::HashMap; /// /// When changing this trait, make sure all the operations are /// implemented in the related type in `../metrics/`. -pub trait DualLabeledCounter: TestGetValue<HashMap<String, HashMap<String, i32>>> { +pub trait DualLabeledCounter: TestGetValue<Output = HashMap<String, HashMap<String, i32>>> { /// Gets a specific counter for a given key/category pair. /// /// If a set of acceptable keys or categorires were specified in the `metrics.yaml` file, diff --git a/third_party/rust/glean-core/src/traits/event.rs b/third_party/rust/glean-core/src/traits/event.rs @@ -6,7 +6,7 @@ use std::collections::HashMap; use std::hash::Hash; use crate::event_database::RecordedEvent; -use crate::{ErrorType, TestGetValue}; +use crate::TestGetValue; /// Extra keys for events. /// @@ -76,7 +76,7 @@ impl TryFrom<&str> for NoExtraKeys { /// /// When changing this trait, make sure all the operations are /// implemented in the related type in `../metrics/`. -pub trait Event: TestGetValue<Vec<RecordedEvent>> { +pub trait Event: TestGetValue<Output = Vec<RecordedEvent>> { /// The type of the allowed extra keys for this event. type Extra: ExtraKeys; @@ -86,17 +86,4 @@ pub trait Event: TestGetValue<Vec<RecordedEvent>> { /// /// * `extra` - (optional) An object for the extra keys. fn record<M: Into<Option<Self::Extra>>>(&self, extra: M); - - /// **Exported for test purposes.** - /// - /// Gets the number of recorded errors for the given metric and error type. - /// - /// # Arguments - /// - /// * `error` - The type of error - /// - /// # Returns - /// - /// The number of errors reported. - fn test_get_num_recorded_errors(&self, error: ErrorType) -> i32; } diff --git a/third_party/rust/glean-core/src/traits/memory_distribution.rs b/third_party/rust/glean-core/src/traits/memory_distribution.rs @@ -10,7 +10,7 @@ use crate::{ErrorType, TestGetValue}; /// /// When changing this trait, make sure all the operations are /// implemented in the related type in `../metrics/`. -pub trait MemoryDistribution: TestGetValue<DistributionData> { +pub trait MemoryDistribution: TestGetValue<Output = DistributionData> { /// Accumulates the provided sample in the metric. /// /// # Arguments diff --git a/third_party/rust/glean-core/src/traits/numerator.rs b/third_party/rust/glean-core/src/traits/numerator.rs @@ -8,7 +8,7 @@ use crate::{ErrorType, TestGetValue}; // When changing this trait, ensure all operations are implemented in the // related type in `../metrics`. (Except test_get_num_errors) /// A description for the `NumeratorMetric` subtype of the [`RateMetric`](crate::metrics::RateMetric) type. -pub trait Numerator: TestGetValue<Rate> { +pub trait Numerator: TestGetValue<Output = Rate> { /// Increases the numerator by `amount`. /// /// # Arguments diff --git a/third_party/rust/glean-core/src/traits/quantity.rs b/third_party/rust/glean-core/src/traits/quantity.rs @@ -8,7 +8,7 @@ use crate::{ErrorType, TestGetValue}; /// /// When changing this trait, make sure all the operations are /// implemented in the related type in `../metrics/`. -pub trait Quantity: TestGetValue<i64> { +pub trait Quantity: TestGetValue<Output = i64> { /// Sets the value. Must be non-negative. /// /// # Arguments diff --git a/third_party/rust/glean-core/src/traits/rate.rs b/third_party/rust/glean-core/src/traits/rate.rs @@ -7,7 +7,7 @@ use crate::{ErrorType, TestGetValue}; // When changing this trait, ensure all operations are implemented in the // related type in `../metrics`. (Except test_get_num_errors) /// A description for the [`RateMetric`](crate::metrics::RateMetric) type. -pub trait Rate: TestGetValue<crate::Rate> { +pub trait Rate: TestGetValue<Output = crate::Rate> { /// Increases the numerator by `amount`. /// /// # Arguments diff --git a/third_party/rust/glean-core/src/traits/string.rs b/third_party/rust/glean-core/src/traits/string.rs @@ -8,7 +8,7 @@ use crate::{ErrorType, TestGetValue}; /// /// When changing this trait, make sure all the operations are /// implemented in the related type in `../metrics/`. -pub trait String: TestGetValue<std::string::String> { +pub trait String: TestGetValue<Output = std::string::String> { /// Sets to the specified value. /// /// # Arguments diff --git a/third_party/rust/glean-core/src/traits/string_list.rs b/third_party/rust/glean-core/src/traits/string_list.rs @@ -8,7 +8,7 @@ use crate::{ErrorType, TestGetValue}; /// /// When changing this trait, make sure all the operations are /// implemented in the related type in `../metrics/`. -pub trait StringList: TestGetValue<Vec<String>> { +pub trait StringList: TestGetValue<Output = Vec<String>> { /// Adds a new string to the list. /// /// # Arguments diff --git a/third_party/rust/glean-core/src/traits/text.rs b/third_party/rust/glean-core/src/traits/text.rs @@ -8,7 +8,7 @@ use crate::{ErrorType, TestGetValue}; /// /// When changing this trait, make sure all the operations are /// implemented in the related type in `../metrics/`. -pub trait Text: TestGetValue<String> { +pub trait Text: TestGetValue<Output = String> { /// Sets to the specified value. /// /// # Arguments diff --git a/third_party/rust/glean-core/src/traits/timespan.rs b/third_party/rust/glean-core/src/traits/timespan.rs @@ -9,7 +9,7 @@ use std::time::Duration; /// /// When changing this trait, make sure all the operations are /// implemented in the related type in `../metrics/`. -pub trait Timespan: TestGetValue<u64> { +pub trait Timespan: TestGetValue<Output = u64> { /// Starts tracking time for the provided metric. /// /// This uses an internal monotonic timer. diff --git a/third_party/rust/glean-core/src/traits/timing_distribution.rs b/third_party/rust/glean-core/src/traits/timing_distribution.rs @@ -12,7 +12,7 @@ use std::time::Duration; /// /// When changing this trait, make sure all the operations are /// implemented in the related type in `../metrics/`. -pub trait TimingDistribution: TestGetValue<DistributionData> { +pub trait TimingDistribution: TestGetValue<Output = DistributionData> { /// Start tracking time for the provided metric. /// Multiple timers can run simultaneously. /// diff --git a/third_party/rust/glean-core/src/traits/url.rs b/third_party/rust/glean-core/src/traits/url.rs @@ -8,7 +8,7 @@ use crate::{ErrorType, TestGetValue}; /// /// When changing this trait, make sure all the operations are /// implemented in the related type in `../metrics/`. -pub trait Url: TestGetValue<String> { +pub trait Url: TestGetValue<Output = String> { /// Sets to the specified stringified URL. /// /// # Arguments diff --git a/third_party/rust/glean-core/src/traits/uuid.rs b/third_party/rust/glean-core/src/traits/uuid.rs @@ -8,7 +8,7 @@ use crate::{ErrorType, TestGetValue}; /// /// When changing this trait, make sure all the operations are /// implemented in the related type in `../metrics/`. -pub trait Uuid: TestGetValue<uuid::Uuid> { +pub trait Uuid: TestGetValue<Output = uuid::Uuid> { /// Sets to the specified value. /// /// # Arguments diff --git a/third_party/rust/glean-core/src/upload/mod.rs b/third_party/rust/glean-core/src/upload/mod.rs @@ -756,7 +756,7 @@ impl PingUploadManager { ) -> UploadTaskAction { use UploadResult::*; - let stop_time = zeitstempel::now(); + let stop_time = zeitstempel::now_awake(); if let Some(label) = status.get_label() { let metric = self.upload_metrics.ping_upload_failure.get(label); diff --git a/third_party/rust/glean/.cargo-checksum.json b/third_party/rust/glean/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.lock":"c5fd7744f92d6dce3861884b8c185ea40ff0b891a3d61ef99e0d5bbf77b337bc","Cargo.toml":"359b72541149497067afeeeb625a822a05d3ebb4521d3b09ae051d8a36c5c11f","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"5627cc81e6187ab6c2b4dff061af16d559edcab64ba786bac39daa69c703c595","src/common_test.rs":"c86cccfb7da1506cfed29cb2ee13d839b7ac7cffdfd70793c9665bb44e0b684f","src/configuration.rs":"de65ab99a26b4547be20803bc195cb50a6ab40b1a3f49a2e6230fed5a9d7a8d8","src/core_metrics.rs":"fef8fb4e5fa57c179836c6eb2cf59278fe3b8b036dbe57b0ff02971b4acd822f","src/lib.rs":"3c73125967a4cb026bd4d7ca898edd3d2bee61c35abcfbcd875852552c540b52","src/net/http_uploader.rs":"0a94ac3cd87cb021529dee46d537765ab8d923e0f4ac7615225e878d3739e6dc","src/net/mod.rs":"95d2c0744caa9e336f4c4d0cef698202eb65d39b4c025a2da3902dffecdede73","src/private/event.rs":"58f2f4474261d7312370d6e8aeeca2f2a0b4124adbda596ee72b052c2ad585e9","src/private/mod.rs":"de67f272a20b9b5ead58a40073a82ba54f9dd1b7d0d14c7b916fc714c961ead4","src/private/object.rs":"6e58703fa760edb4cb6da4f68fdbfbae5b55a63194d681504883c11c8daac624","src/private/ping.rs":"8ec514e88c1fcba13560522c83e39643edf7d74a3dc733e273984c46c781b2d2","src/system.rs":"d602804a72258bfd65e51c571946631732ee27d81342d8aa406e47fdd241bbfa","src/test.rs":"3bd23be7c82864543d8c918fa3d61e821199799f0d276880b9339a20a303768f","tests/collection_enabled.rs":"3327a949dbdeec493d661261abda68ffa71acc50ab24cba4fde5302749e6f16b","tests/collection_enabled_bin.rs":"d3a6458b84012a447e5cb792f2292a06951ed252fad803b9166b437bacba542c","tests/common/mod.rs":"2fd391c5eb45f56fdfa3261dd631406c67ed36b10b0d5432febe2483da5c9d89","tests/custom_distribution_buffered.rs":"aa70bc2e2aca14c5c8a30dafd246d2657769fa7cdf4d09a6f10a03a356c696f6","tests/dual_labeled_counter_metric.rs":"91e9e206a4f331e067f55e5cde7eb0b893e41ea08eb125371e7b03fe44cb1445","tests/health_ping.rs":"1489995efa25fe1518003b048990fb405c90664e270802ec913cc8de737e4b74","tests/init_fails.rs":"ca7fa1b3dd6a21a9e005b7a4f0a18664c4bceb952dd463db8316500f72280d5b","tests/interruptible_shutdown.rs":"60f057bd495843a6d97cc9f875be1aa944b43c5f9a034c58d648b2d629195989","tests/labeled_metrics.rs":"d9b14025054a0ee9b89b60e720435828257eda7ec61f349389ab387923d3954c","tests/memory_distribution_buffered.rs":"e809a8de47ea4ac10c1181651d48b11aa11f57704d95f10ae194762e5d3d2982","tests/metric_metadata.rs":"e0188fcf8dc8f754f905a0662932d341646429589795bf10407645c0b3034ad2","tests/near-empty-c0ffee-db.safe.bin":"89afb3bb8fc94430fb0ed0fe55f85f3f8bcc8fd0fed69a9df13cc560294ec9f5","tests/never_init.rs":"51fff5618f6603bc0945d70131698d10a1c6275f43bbc22a2de5807f8a79229f","tests/no_time_to_init.rs":"2ede23df6618ff1cb5ae3b7bbf95900ad0fd92072afa2e0319bf147b4f75cefc","tests/overflowing_preinit.rs":"dc4d5eccb84c3c9ca25221bdc4a9bbf50ebc36d6d83d27f36d93f4562fb75d5d","tests/persist_ping_lifetime_nopanic.rs":"18379d3ffbf4a2c8c684c04ff7a0660b86dfbbb447db2d24dfed6073cb7ddf8f","tests/schema.rs":"23b49005402b914e55a0c5c155f30c2662c609f79be78d1385ec25b3600b3547","tests/simple.rs":"79d78a4cdc439c92b4efbbb2aa181ec1fd232c7a6264ad7832ab2a574ea74939","tests/test-delayed-ping-data.sh":"b6a86e07e47c301529e3bcca5265eba091c6626e38a495ad05f94f1654e6450e","tests/test-enabled-pings.sh":"f094f5735c1bb66da854de0eae84098527fff9b59854888da6f2865308847383","tests/test-mps-delay.sh":"207661a72bf8c05a8b44ad40f208826338069e2f7f4dc3f589aabc35606732e8","tests/test-pending-gets-removed.sh":"7099aaf770cfae070ee4427557cb33981734e18fe145890917d5e8ca324ea011","tests/test-ping-lifetime-flush.sh":"ed7dfc57ce71677e6b310286aed563ab4baa69aad9554cbd045fe5e49903b63a","tests/test-shutdown-blocking.sh":"77402ba408ffb69c19da01d9bffc8a1be8c735efdb84575512f778a07e8e77d1","tests/test-thread-crashing.sh":"e0e5ca6caa95e43d78369eb227cb523108486b31f8289b97bc012c37cdf8bc5c","tests/timing_distribution_buffered.rs":"b96cd123ff830175597d32667477eac9102e05aea6726382c83b35b6bc66176c","tests/timing_distribution_single_sample.rs":"bca54132d5fec225788f0292e8b6c11fa658405dc0586a2bbd84b86c1558f4bd","tests/upload_timing.rs":"e7271e7a71fc5df98c9695a01f89039f4011849c709c8dc99af23bb7e047f3e1","tests/uploader_capabilities.rs":"0c2d70ed51fba444a94aef522e7cb9253c939551694babe0045b2358e3e85b34"},"package":"895946f5a54f9d54c24175af3a064c9ecf8b4f9374afb26132b583f179fc6be2"} -\ No newline at end of file +{"files":{"Cargo.lock":"975185d5c453db2d68602487bb2ff0267798edcc805181d61799feafe2bcd3ab","Cargo.toml":"db140ddeda034ae3abc7b8668055daa189166c21b1e5abb31e9870fada0fab82","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"5627cc81e6187ab6c2b4dff061af16d559edcab64ba786bac39daa69c703c595","src/common_test.rs":"c86cccfb7da1506cfed29cb2ee13d839b7ac7cffdfd70793c9665bb44e0b684f","src/configuration.rs":"de65ab99a26b4547be20803bc195cb50a6ab40b1a3f49a2e6230fed5a9d7a8d8","src/core_metrics.rs":"fef8fb4e5fa57c179836c6eb2cf59278fe3b8b036dbe57b0ff02971b4acd822f","src/lib.rs":"3c73125967a4cb026bd4d7ca898edd3d2bee61c35abcfbcd875852552c540b52","src/net/http_uploader.rs":"0a94ac3cd87cb021529dee46d537765ab8d923e0f4ac7615225e878d3739e6dc","src/net/mod.rs":"95d2c0744caa9e336f4c4d0cef698202eb65d39b4c025a2da3902dffecdede73","src/private/event.rs":"e6c76b384771b6ca5e0bc77f0e563ff768798be0985b1b7858e5921af497d197","src/private/mod.rs":"de67f272a20b9b5ead58a40073a82ba54f9dd1b7d0d14c7b916fc714c961ead4","src/private/object.rs":"4dde92c7700d68fb7113ae57ef84c0ec14f5c786a2f0758ae700f458891613be","src/private/ping.rs":"8ec514e88c1fcba13560522c83e39643edf7d74a3dc733e273984c46c781b2d2","src/system.rs":"d602804a72258bfd65e51c571946631732ee27d81342d8aa406e47fdd241bbfa","src/test.rs":"ffc54a3cab5950148cee0750b11de883f1346bce1d9b7755143e3d5ba78f7533","tests/collection_enabled.rs":"3327a949dbdeec493d661261abda68ffa71acc50ab24cba4fde5302749e6f16b","tests/collection_enabled_bin.rs":"d3a6458b84012a447e5cb792f2292a06951ed252fad803b9166b437bacba542c","tests/common/mod.rs":"2fd391c5eb45f56fdfa3261dd631406c67ed36b10b0d5432febe2483da5c9d89","tests/custom_distribution_buffered.rs":"aa70bc2e2aca14c5c8a30dafd246d2657769fa7cdf4d09a6f10a03a356c696f6","tests/dual_labeled_counter_metric.rs":"91e9e206a4f331e067f55e5cde7eb0b893e41ea08eb125371e7b03fe44cb1445","tests/health_ping.rs":"1489995efa25fe1518003b048990fb405c90664e270802ec913cc8de737e4b74","tests/init_fails.rs":"ca7fa1b3dd6a21a9e005b7a4f0a18664c4bceb952dd463db8316500f72280d5b","tests/interruptible_shutdown.rs":"60f057bd495843a6d97cc9f875be1aa944b43c5f9a034c58d648b2d629195989","tests/labeled_metrics.rs":"d9b14025054a0ee9b89b60e720435828257eda7ec61f349389ab387923d3954c","tests/memory_distribution_buffered.rs":"e809a8de47ea4ac10c1181651d48b11aa11f57704d95f10ae194762e5d3d2982","tests/metric_metadata.rs":"e0188fcf8dc8f754f905a0662932d341646429589795bf10407645c0b3034ad2","tests/near-empty-c0ffee-db.safe.bin":"89afb3bb8fc94430fb0ed0fe55f85f3f8bcc8fd0fed69a9df13cc560294ec9f5","tests/never_init.rs":"51fff5618f6603bc0945d70131698d10a1c6275f43bbc22a2de5807f8a79229f","tests/no_time_to_init.rs":"2ede23df6618ff1cb5ae3b7bbf95900ad0fd92072afa2e0319bf147b4f75cefc","tests/overflowing_preinit.rs":"dc4d5eccb84c3c9ca25221bdc4a9bbf50ebc36d6d83d27f36d93f4562fb75d5d","tests/persist_ping_lifetime_nopanic.rs":"18379d3ffbf4a2c8c684c04ff7a0660b86dfbbb447db2d24dfed6073cb7ddf8f","tests/schema.rs":"23b49005402b914e55a0c5c155f30c2662c609f79be78d1385ec25b3600b3547","tests/signaling_done.rs":"d4ed662955ab665566508817d2d195405b44966667aabdee21510f5cb42dbe9f","tests/simple.rs":"79d78a4cdc439c92b4efbbb2aa181ec1fd232c7a6264ad7832ab2a574ea74939","tests/test-delayed-ping-data.sh":"b6a86e07e47c301529e3bcca5265eba091c6626e38a495ad05f94f1654e6450e","tests/test-enabled-pings.sh":"f094f5735c1bb66da854de0eae84098527fff9b59854888da6f2865308847383","tests/test-mps-delay.sh":"207661a72bf8c05a8b44ad40f208826338069e2f7f4dc3f589aabc35606732e8","tests/test-pending-gets-removed.sh":"7099aaf770cfae070ee4427557cb33981734e18fe145890917d5e8ca324ea011","tests/test-ping-lifetime-flush.sh":"ed7dfc57ce71677e6b310286aed563ab4baa69aad9554cbd045fe5e49903b63a","tests/test-shutdown-blocking.sh":"77402ba408ffb69c19da01d9bffc8a1be8c735efdb84575512f778a07e8e77d1","tests/test-thread-crashing.sh":"e0e5ca6caa95e43d78369eb227cb523108486b31f8289b97bc012c37cdf8bc5c","tests/timing_distribution_buffered.rs":"b96cd123ff830175597d32667477eac9102e05aea6726382c83b35b6bc66176c","tests/timing_distribution_single_sample.rs":"bca54132d5fec225788f0292e8b6c11fa658405dc0586a2bbd84b86c1558f4bd","tests/upload_timing.rs":"e7271e7a71fc5df98c9695a01f89039f4011849c709c8dc99af23bb7e047f3e1","tests/uploader_capabilities.rs":"0c2d70ed51fba444a94aef522e7cb9253c939551694babe0045b2358e3e85b34"},"package":"3acc348bbf540abeedf7c271daf952b1e24311e2ea1c1f8ac172a5cedf37ac91"} +\ No newline at end of file diff --git a/third_party/rust/glean/Cargo.lock b/third_party/rust/glean/Cargo.lock @@ -163,9 +163,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "chrono" @@ -312,7 +312,7 @@ dependencies = [ [[package]] name = "glean" -version = "65.2.2" +version = "66.0.0" dependencies = [ "crossbeam-channel", "env_logger", @@ -331,9 +331,9 @@ dependencies = [ [[package]] name = "glean-core" -version = "65.2.2" +version = "66.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b22a5ae2c3fd542fb8388da0de68542748f466c8df9a815c8b9cc274894ab919" +checksum = "540e40007a01e43b73904d1ee8f7efd4782f1a7f4a20ef1dd6d2c00fc18d54b6" dependencies = [ "android_logger", "bincode", @@ -525,9 +525,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.176" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" [[package]] name = "linux-raw-sys" @@ -604,9 +604,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.2" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "ordered-float" @@ -1313,9 +1313,9 @@ dependencies = [ [[package]] name = "zeitstempel" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94652f036694517fa67509942c3b60a51a19e1cd9cfd0f456eeb830ae8798d3d" +checksum = "f523a0d9326c4f3242ad3a9d306baa7fe4572fd532cc891cabecfb714c786c1e" dependencies = [ "cfg-if", "libc", diff --git a/third_party/rust/glean/Cargo.toml b/third_party/rust/glean/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.82" name = "glean" -version = "65.2.2" +version = "66.0.0" authors = [ "Jan-Erik Rediger <jrediger@mozilla.com>", "The Glean Team <glean-team@mozilla.com>", @@ -104,6 +104,10 @@ name = "schema" path = "tests/schema.rs" [[test]] +name = "signaling_done" +path = "tests/signaling_done.rs" + +[[test]] name = "simple" path = "tests/simple.rs" @@ -127,7 +131,7 @@ path = "tests/uploader_capabilities.rs" version = "0.5" [dependencies.glean-core] -version = "65.2.2" +version = "66.0.0" [dependencies.inherent] version = "1" diff --git a/third_party/rust/glean/src/private/event.rs b/third_party/rust/glean/src/private/event.rs @@ -71,8 +71,28 @@ impl<K: traits::ExtraKeys> EventMetric<K> { } } +// Separately implemented so it doesn't require `K: ExtraKeys`. +impl<K> EventMetric<K> { + /// **Exported for test purposes.** + /// + /// Gets the number of recorded errors for the given metric and error type. + /// + /// # Arguments + /// + /// * `error` - The type of error + /// + /// # Returns + /// + /// The number of errors reported. + pub fn test_get_num_recorded_errors(&self, error: ErrorType) -> i32 { + self.inner.test_get_num_recorded_errors(error) + } +} + #[inherent] -impl<K> TestGetValue<Vec<RecordedEvent>> for EventMetric<K> { +impl<K> TestGetValue for EventMetric<K> { + type Output = Vec<RecordedEvent>; + pub fn test_get_value(&self, ping_name: Option<String>) -> Option<Vec<RecordedEvent>> { self.inner.test_get_value(ping_name) } @@ -89,10 +109,6 @@ impl<K: traits::ExtraKeys> traits::Event for EventMetric<K> { .unwrap_or_else(HashMap::new); self.inner.record(extra); } - - pub fn test_get_num_recorded_errors(&self, error: ErrorType) -> i32 { - self.inner.test_get_num_recorded_errors(error) - } } #[cfg(test)] diff --git a/third_party/rust/glean/src/private/object.rs b/third_party/rust/glean/src/private/object.rs @@ -39,7 +39,9 @@ impl<'a, K> MetricIdentifier<'a> for ObjectMetric<K> { } } -impl<K> TestGetValue<JsonValue> for ObjectMetric<K> { +impl<K> TestGetValue for ObjectMetric<K> { + type Output = JsonValue; + /// **Test-only API (exported for FFI purposes).** /// /// Gets the currently stored value as JSON-encoded string. diff --git a/third_party/rust/glean/src/test.rs b/third_party/rust/glean/src/test.rs @@ -3,8 +3,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. use std::io::Read; -use std::sync::{Arc, Barrier, Mutex}; -use std::thread::{self, ThreadId}; +use std::sync::Arc; use std::time::{Duration, Instant}; use crossbeam_channel::RecvTimeoutError; @@ -1389,76 +1388,6 @@ fn test_text_can_hold_long_string() { } #[test] -fn signaling_done() { - let _lock = lock_test(); - - // Define a fake uploader that reports back the submission URL - // using a crossbeam channel. - #[derive(Debug)] - pub struct FakeUploader { - barrier: Arc<Barrier>, - counter: Arc<Mutex<HashMap<ThreadId, u32>>>, - } - impl net::PingUploader for FakeUploader { - fn upload(&self, _upload_request: net::CapablePingUploadRequest) -> net::UploadResult { - let mut map = self.counter.lock().unwrap(); - *map.entry(thread::current().id()).or_insert(0) += 1; - - // Wait for the sync. - self.barrier.wait(); - - // Signal that this uploader thread is done. - net::UploadResult::done() - } - } - - // Create a custom configuration to use a fake uploader. - let dir = tempfile::tempdir().unwrap(); - let tmpname = dir.path().to_path_buf(); - - // We use a barrier to sync this test thread with the uploader thread. - let barrier = Arc::new(Barrier::new(2)); - // We count how many times `upload` was invoked per thread. - let call_count = Arc::new(Mutex::default()); - - let cfg = ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID) - .with_server_endpoint("invalid-test-host") - .with_uploader(FakeUploader { - barrier: Arc::clone(&barrier), - counter: Arc::clone(&call_count), - }) - .build(); - - let _t = new_glean(Some(cfg), true); - - // Define a new ping and submit it. - const PING_NAME: &str = "test-ping"; - let custom_ping = new_test_ping(PING_NAME); - custom_ping.submit(None); - custom_ping.submit(None); - - // Sync up with the upload thread. - barrier.wait(); - - // Submit another ping and wait for it to do work. - custom_ping.submit(None); - - // Sync up with the upload thread again. - // This will not be the same thread as the one before (hopefully). - barrier.wait(); - - // No one's ever gonna wait for the uploader thread (the RLB doesn't store the handle to it), - // so all we can do is hope it finishes within time. - std::thread::sleep(std::time::Duration::from_millis(100)); - - let map = call_count.lock().unwrap(); - assert_eq!(2, map.len(), "should have launched 2 uploader threads"); - for &count in map.values() { - assert_eq!(1, count, "each thread should call upload only once"); - } -} - -#[test] fn configure_ping_throttling() { let _lock = lock_test(); diff --git a/third_party/rust/glean/tests/signaling_done.rs b/third_party/rust/glean/tests/signaling_done.rs @@ -0,0 +1,104 @@ +// 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/. + +//! This integration test should model how the RLB is used when embedded in another Rust application +//! (e.g. FOG/Firefox Desktop). +//! +//! We write a single test scenario per file to avoid any state keeping across runs +//! (different files run as different processes). + +mod common; + +use std::collections::HashMap; +use std::sync::Arc; +use std::sync::Barrier; +use std::sync::Mutex; +use std::thread; +use std::thread::ThreadId; + +use glean::net; +use glean::ConfigurationBuilder; + +mod pings { + use super::*; + use glean::private::PingType; + use once_cell::sync::Lazy; + + #[allow(non_upper_case_globals)] + pub static custom_ping: Lazy<PingType> = Lazy::new(|| { + common::PingBuilder::new("test-ping") + .with_send_if_empty(true) + .build() + }); +} + +// Define a fake uploader that counts its number of invocations on a single thread +// and waits for a signal to continue (and signal that it is done). +#[derive(Debug)] +pub struct FakeUploader { + barrier: Arc<Barrier>, + counter: Arc<Mutex<HashMap<ThreadId, u32>>>, +} + +impl net::PingUploader for FakeUploader { + fn upload(&self, _upload_request: net::CapablePingUploadRequest) -> net::UploadResult { + let mut map = self.counter.lock().unwrap(); + *map.entry(thread::current().id()).or_insert(0) += 1; + + // Wait for the sync. + self.barrier.wait(); + + // Signal that this uploader thread is done. + net::UploadResult::done() + } +} + +#[test] +fn signaling_done() { + common::enable_test_logging(); + + // Create a custom configuration to use a fake uploader. + let dir = tempfile::tempdir().unwrap(); + let tmpname = dir.path().to_path_buf(); + + // We use a barrier to sync this test thread with the uploader thread. + let barrier = Arc::new(Barrier::new(2)); + // We count how many times `upload` was invoked per thread. + let call_count = Arc::new(Mutex::default()); + + let cfg = ConfigurationBuilder::new(true, tmpname, "glean-signaling-done") + .with_server_endpoint("invalid-test-host") + .with_uploader(FakeUploader { + barrier: Arc::clone(&barrier), + counter: Arc::clone(&call_count), + }) + .with_internal_pings(false) + .build(); + + common::initialize(cfg); + + // Submit the new ping. + pings::custom_ping.submit(None); + pings::custom_ping.submit(None); + + // Sync up with the upload thread. + barrier.wait(); + + // Submit another ping and wait for it to do work. + pings::custom_ping.submit(None); + + // Sync up with the upload thread again. + // This will not be the same thread as the one before (hopefully). + barrier.wait(); + + // No one's ever gonna wait for the uploader thread (the RLB doesn't store the handle to it), + // so all we can do is hope it finishes within time. + std::thread::sleep(std::time::Duration::from_millis(100)); + + let map = call_count.lock().unwrap(); + assert_eq!(2, map.len(), "should have launched 2 uploader threads"); + for &count in map.values() { + assert_eq!(1, count, "each thread should call upload only once"); + } +} diff --git a/third_party/rust/zeitstempel/.cargo-checksum.json b/third_party/rust/zeitstempel/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.lock":"4e58098487fc65f3d05031d2eca95c99f1dad653133b0d8a340fe8b7a1e1c0eb","Cargo.toml":"20f0aef19260cf289dde8fecc0a72a905ba1874b0940a229d29982846129b0f5","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"fd0ac92bb6c2b4c5c8b476ef1869cb63d2cecf9f6d416a8f49524985293b70f0","examples/uptime.rs":"f153cdaa783e8a8dbd181d33dc3499f7bd959bf63904896683a0d007e4d907b4","src/fallback.rs":"76181732f5677d39fe2a48a0c8f2254cd9dcea973dbbe798ed13006de8c13fb6","src/lib.rs":"4e17067717e5c15a5763b649ce1545455a11e520e42877937156d19d5465fe9d","src/linux.rs":"06197928288889ed6447f90fe1da3b6a3feaaec23690a7380cccb81216fef111","src/mac.rs":"d1cf28b7c7975654494b72ca3f109a2d75826b61ec295aa7512c7c120a476ff6","src/win.rs":"f90cc966453e992d450880ac5c6c7bbe0c1b1035b32d7647f6a55313530b69e2","src/win10.rs":"f3e06d7521b44fb35ef80f6a8f4a6ded6b74f54b0add720704dc1dfe820427b2"},"package":"94652f036694517fa67509942c3b60a51a19e1cd9cfd0f456eeb830ae8798d3d"} -\ No newline at end of file +{"files":{"Cargo.lock":"80940c595ec25272279bb1430954117b0f9ac23cf661abbc4060e86fd43dac0f","Cargo.toml":"2a856735c4a46353744104325a6bbd2f400672e07e85fcb1c4219657c112ed80","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"c7a1c11909f05406fe2ced224ea3e9d2ea5d7a572a0552ea2a582a7a60978689","examples/uptime.rs":"f153cdaa783e8a8dbd181d33dc3499f7bd959bf63904896683a0d007e4d907b4","src/fallback.rs":"1e6179bb942837d7ef2ca9d0ad2adfcc6a25810a95c820e897e0bbe171e6a94b","src/lib.rs":"373aae803190adf55af61868715bb800cdad414c5db0f12ed5e7caf935a73c1f","src/linux.rs":"959140d6537770ff4f98110448acd8fc743710017ebf75a73ebfef27b8bc6e1f","src/mac.rs":"17f9e993654ea55b0049cda6212731f1151d957fcd60601b68d58b7e37b46c80","src/win.rs":"c47bce3a19358adb8d991155d63616543073f0f425cdc6b7953bb55c7acb50e4","src/win10.rs":"6c10007d110a67f053e13f9b5bcf8fd68a4f70c04d61576ae5be9d2266701e54"},"package":"f523a0d9326c4f3242ad3a9d306baa7fe4572fd532cc891cabecfb714c786c1e"} +\ No newline at end of file diff --git a/third_party/rust/zeitstempel/Cargo.lock b/third_party/rust/zeitstempel/Cargo.lock @@ -44,7 +44,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "zeitstempel" -version = "0.1.2" +version = "0.2.0" dependencies = [ "cfg-if", "libc", diff --git a/third_party/rust/zeitstempel/Cargo.toml b/third_party/rust/zeitstempel/Cargo.toml @@ -12,7 +12,7 @@ [package] edition = "2018" name = "zeitstempel" -version = "0.1.2" +version = "0.2.0" authors = ["Jan-Erik Rediger <jrediger@mozilla.com>"] build = false autolib = false @@ -47,4 +47,7 @@ version = "0.2" [target."cfg(windows)".dependencies.winapi] version = "0.3" -features = ["profileapi"] +features = [ + "profileapi", + "realtimeapiset", +] diff --git a/third_party/rust/zeitstempel/README.md b/third_party/rust/zeitstempel/README.md @@ -11,8 +11,8 @@ zeitstempel is German for "timestamp". Time's hard. Correct time is near impossible. This crate has one purpose: give me a timestamp as an integer, coming from a monotonic clock -source, include time across suspend/hibernation of the host machine and let me compare it to -other timestamps. +source, guaranteed with or without time across suspend/hibernation of the host machine, +and let me compare it to other timestamps. It becomes the developer's responsibility to only compare timestamps obtained from this clock source. Timestamps are not comparable across operating system reboots. @@ -33,11 +33,10 @@ However: [rustsource]: https://doc.rust-lang.org/1.47.0/src/std/time.rs.html#213-237 -# Example +# Example with suspend time ```rust -use std::{thread, time::Duration}; - +# use std::{thread, time::Duration}; let start = zeitstempel::now(); thread::sleep(Duration::from_millis(2)); @@ -45,6 +44,17 @@ let diff = Duration::from_nanos(zeitstempel::now() - start); assert!(diff >= Duration::from_millis(2)); ``` +# Example with only awake time + +```rust +# use std::{thread, time::Duration}; +let start = zeitstempel::now_awake(); +thread::sleep(Duration::from_millis(2)); + +let diff = Duration::from_nanos(zeitstempel::now_awake() - start); +assert!(diff >= Duration::from_millis(2)); +``` + # Supported operating systems We support the following operating systems: diff --git a/third_party/rust/zeitstempel/src/fallback.rs b/third_party/rust/zeitstempel/src/fallback.rs @@ -21,3 +21,19 @@ pub fn now_including_suspend() -> u64 { .and_then(|diff| diff.as_nanos().try_into().ok()) .unwrap_or(0) } + +pub fn now_awake() -> u64 { + // This fallback is not used on Windows, and there it probably is wrong because it includes suspend time. + // + // This fallback is not used on Linux, though it would still be correct, as it maps to `CLOCK_MONOTONIC`, which does NOT + // include suspend time. + // + // This fallback is not used on macOS, though it would still be correct, as it maps to `mach_absolute_time`, which does NOT + // include suspend time. But we don't use it there, so no problem. + // + // For other operating systems we make no guarantees, other than that we won't panic. + let now = Instant::now(); + now.checked_duration_since(*INIT_TIME) + .and_then(|diff| diff.as_nanos().try_into().ok()) + .unwrap_or(0) +} diff --git a/third_party/rust/zeitstempel/src/lib.rs b/third_party/rust/zeitstempel/src/lib.rs @@ -5,8 +5,8 @@ //! Time's hard. Correct time is near impossible. //! //! This crate has one purpose: give me a timestamp as an integer, coming from a monotonic clock -//! source, include time across suspend/hibernation of the host machine and let me compare it to -//! other timestamps. +//! source, guaranteed with or without time across suspend/hibernation of the host machine, +//! and let me compare it to other timestamps. //! //! It becomes the developer's responsibility to only compare timestamps obtained from this clock source. //! Timestamps are not comparable across operating system reboots. @@ -21,11 +21,11 @@ //! However: //! //! * It can't be serialized. -//! * It's not guaranteed that the clock source it uses contains suspend/hibernation time across all operating systems. +//! * It's not guaranteed that the clock source it uses contains (or exclude) suspend/hibernation time across all operating systems. //! //! [rustsource]: https://doc.rust-lang.org/1.47.0/src/std/time.rs.html#213-237 //! -//! # Example +//! # Example with suspend time //! //! ``` //! # use std::{thread, time::Duration}; @@ -36,6 +36,17 @@ //! assert!(diff >= Duration::from_millis(2)); //! ``` //! +//! # Example with only awake time +//! +//! ``` +//! # use std::{thread, time::Duration}; +//! let start = zeitstempel::now_awake(); +//! thread::sleep(Duration::from_millis(2)); +//! +//! let diff = Duration::from_nanos(zeitstempel::now_awake() - start); +//! assert!(diff >= Duration::from_millis(2)); +//! ``` +//! //! # Supported operating systems //! //! We support the following operating systems: @@ -74,7 +85,7 @@ cfg_if::cfg_if! { } } -/// Returns a timestamp corresponding to "now". +/// Returns a timestamp corresponding to "now", including suspend time. /// /// It can be compared to other timestamps gathered from this API, as long as the host was not /// rebooted inbetween. @@ -91,6 +102,23 @@ pub fn now() -> u64 { sys::now_including_suspend() } +/// Returns a timestamp corresponding to "now", excluding suspend time. +/// +/// It can be compared to other timestamps gathered from this API, as long as the host was not +/// rebooted inbetween. +/// +/// +/// ## Note +/// +/// * The difference between two timestamps will NOT include time the system was in sleep or +/// hibernation. +/// * The difference between two timestamps gathered from this is in nanoseconds. +/// * The clocks on some operating systems, e.g. on Windows, are not nanosecond-precise. +/// The value will still use nanosecond resolution. +pub fn now_awake() -> u64 { + sys::now_awake() +} + #[cfg(test)] mod test { use super::*; @@ -105,4 +133,27 @@ mod test { assert!(ts1 < ts2); } + + #[test] + fn awake_time_atleast_total_time() { + let ts1 = now(); + let a_ts1 = now_awake(); + thread::sleep(Duration::from_millis(2)); + let ts2 = now(); + let a_ts2 = now_awake(); + + assert!(ts1 < ts2); + assert!(a_ts1 < a_ts2); + let total_diff = Duration::from_nanos(ts2 - ts1); + let awake_diff = Duration::from_nanos(a_ts2 - a_ts1); + // `now_awake` gives us nanosecond resolution. That might be _too_ precise, + // such that `awake` might be actually longer than `total` due to the calls taking just a + // tiny bit longer. + assert!( + total_diff.as_millis() <= awake_diff.as_millis(), + "total: {:?}, awake: {:?}", + total_diff, + awake_diff + ); + } } diff --git a/third_party/rust/zeitstempel/src/linux.rs b/third_party/rust/zeitstempel/src/linux.rs @@ -22,3 +22,22 @@ pub fn now_including_suspend() -> u64 { timespec_to_ns(ts) } + +/// The time from a clock that cannot be set +/// and represents monotonic time since some unspecified starting point, +/// but that does not increment while the system is asleep. +/// +/// See [`clock_gettime`]. +/// +/// [`clock_gettime`]: https://manpages.debian.org/buster/manpages-dev/clock_gettime.3.en.html +pub fn now_awake() -> u64 { + let mut ts = libc::timespec { + tv_sec: 0, + tv_nsec: 0, + }; + unsafe { + libc::clock_gettime(libc::CLOCK_MONOTONIC, &mut ts); + } + + timespec_to_ns(ts) +} diff --git a/third_party/rust/zeitstempel/src/mac.rs b/third_party/rust/zeitstempel/src/mac.rs @@ -5,6 +5,7 @@ extern "C" { } const CLOCK_MONOTONIC_RAW: clockid_t = 4; +const CLOCK_UPTIME_RAW: clockid_t = 8; /// The time from a clock that increments monotonically, /// tracking the time since an arbitrary point. @@ -15,3 +16,12 @@ const CLOCK_MONOTONIC_RAW: clockid_t = 4; pub fn now_including_suspend() -> u64 { unsafe { clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW) } } + +/// The time from a clock that increments monotonically, +/// in the same manner as CLOCK_MONOTONIC_RAW, +/// but that does not increment while the system is asleep. +/// +/// See `clock_gettime_nsec_np`. +pub fn now_awake() -> u64 { + unsafe { clock_gettime_nsec_np(CLOCK_UPTIME_RAW) } +} diff --git a/third_party/rust/zeitstempel/src/win.rs b/third_party/rust/zeitstempel/src/win.rs @@ -4,8 +4,12 @@ use std::mem; use std::sync::OnceLock; use winapi::um::profileapi::{QueryPerformanceCounter, QueryPerformanceFrequency}; +use winapi::um::realtimeapiset::QueryUnbiasedInterruptTime; use winapi::um::winnt::LARGE_INTEGER; +/// Windows counts time in a system time unit of 100 nanoseconds. +const SYSTEM_TIME_UNIT: u64 = 100; + fn i64_to_large_integer(i: i64) -> LARGE_INTEGER { unsafe { let mut large_integer: LARGE_INTEGER = mem::zeroed(); @@ -47,7 +51,16 @@ fn mul_div_i64(value: i64, numer: i64, denom: i64) -> i64 { pub fn now_including_suspend() -> u64 { let mut ticks = i64_to_large_integer(0); unsafe { - assert!(QueryPerformanceCounter(&mut ticks) == 1); + assert!(QueryPerformanceCounter(&mut ticks) != 0); } mul_div_i64(large_integer_to_i64(ticks), 1000000000, frequency()) as u64 } + +pub fn now_awake() -> u64 { + let mut interrupt_time = 0; + unsafe { + assert!(QueryUnbiasedInterruptTime(&mut interrupt_time) != 0); + } + + interrupt_time * SYSTEM_TIME_UNIT +} diff --git a/third_party/rust/zeitstempel/src/win10.rs b/third_party/rust/zeitstempel/src/win10.rs @@ -4,11 +4,8 @@ #![cfg(feature = "win10plus")] -/// [PULONGLONG] is a pointer to [ULONGLONG], a 64-bit unsigned integer. -/// -/// [PULONGLONG]: https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types#PULONGLONG -/// [ULONGLONG]: https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types#ulonglong -type PULONGLONG = *mut u64; +use winapi::um::realtimeapiset::QueryUnbiasedInterruptTime; +use winapi::um::winnt::PULONGLONG; // Link against Windows' `mincore`. #[link(name = "mincore")] @@ -40,3 +37,12 @@ pub fn now_including_suspend() -> u64 { interrupt_time * SYSTEM_TIME_UNIT } + +pub fn now_awake() -> u64 { + let mut interrupt_time = 0; + unsafe { + assert!(QueryUnbiasedInterruptTime(&mut interrupt_time) != 0); + } + + interrupt_time * SYSTEM_TIME_UNIT +}