From ba3c19142c53f452ead8f2b1032be43be0dfd043 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Thu, 19 Nov 2020 12:54:31 -0800 Subject: [PATCH] deps: update hyper, metrics to tokio 0.3 The metrics code becomes much simpler because the current version of the metrics crate builds its own single-threaded runtime on a dedicated worker thread, so no dependency on the main Zebra Tokio runtime is required. --- Cargo.lock | 518 +++++++++---------------------- Cargo.toml | 4 + zebrad/Cargo.toml | 6 +- zebrad/src/components/metrics.rs | 51 +-- zebrad/src/components/sync.rs | 4 +- 5 files changed, 163 insertions(+), 420 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 489294e6..346da045 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -57,6 +57,15 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" +[[package]] +name = "ahash" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" +dependencies = [ + "const-random", +] + [[package]] name = "ahash" version = "0.4.6" @@ -81,7 +90,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -90,14 +99,14 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] name = "arc-swap" -version = "0.4.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" +checksum = "0688b520bcc7498f6ca8fa006e8031d353e3fd4f51bd4a50fb03cc4230b28bd2" [[package]] name = "arrayref" @@ -137,7 +146,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -181,6 +190,12 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdcf67bb7ba7797a081cd19009948ab533af7c355d5caf1d08c777582d351e9c" +[[package]] +name = "beef" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "474a626a67200bd107d44179bb3d4fc61891172d11696609264589be6a0e6a43" + [[package]] name = "bincode" version = "1.3.1" @@ -236,15 +251,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -[[package]] -name = "bitmaps" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" -dependencies = [ - "typenum", -] - [[package]] name = "bitvec" version = "0.17.4" @@ -431,7 +437,7 @@ dependencies = [ "num-traits", "serde", "time", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -460,15 +466,6 @@ dependencies = [ "vec_map", ] -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags", -] - [[package]] name = "cloudabi" version = "0.1.0" @@ -766,6 +763,17 @@ dependencies = [ "syn 1.0.48", ] +[[package]] +name = "dashmap" +version = "3.11.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f260e2fc850179ef410018660006951c1b55b79e8087e87111a2c388994b9b5" +dependencies = [ + "ahash 0.3.8", + "cfg-if 0.1.10", + "num_cpus", +] + [[package]] name = "difference" version = "2.0.0" @@ -807,7 +815,7 @@ checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" dependencies = [ "libc", "redox_users", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -821,12 +829,6 @@ dependencies = [ "syn 1.0.48", ] -[[package]] -name = "dtoa" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" - [[package]] name = "ed25519-zebra" version = "1.0.1" @@ -951,22 +953,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "funty" version = "1.0.1" @@ -1087,7 +1073,7 @@ dependencies = [ "libc", "log", "rustc_version", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1177,9 +1163,8 @@ dependencies = [ [[package]] name = "h2" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" +version = "0.3.0" +source = "git+https://github.com/hyperium/h2#cbbdd305b1afc1eaf19f2e3b26f9419048041e7d" dependencies = [ "bytes 0.5.6", "fnv", @@ -1189,8 +1174,8 @@ dependencies = [ "http", "indexmap", "slab", - "tokio 0.2.23", - "tokio-util 0.3.1", + "tokio", + "tokio-util 0.4.0", "tracing", "tracing-futures", ] @@ -1215,6 +1200,20 @@ dependencies = [ "num-traits", ] +[[package]] +name = "hdrhistogram" +version = "7.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3c22708574c44e924720c5b3a116326c688e6d532f438c77c007ec8768644f9" +dependencies = [ + "base64 0.12.3", + "byteorder", + "crossbeam-channel 0.4.4", + "flate2", + "nom 5.1.2", + "num-traits", +] + [[package]] name = "heck" version = "0.3.1" @@ -1283,9 +1282,8 @@ dependencies = [ [[package]] name = "hyper" -version = "0.13.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ad767baac13b44d4529fcf58ba2cd0995e36e7b435bc5b039de6f47e880dbf" +version = "0.14.0-dev" +source = "git+https://github.com/hyperium/hyper/?rev=ed2b22a7f66899d338691552fbcb6c0f2f4e06b9#ed2b22a7f66899d338691552fbcb6c0f2f4e06b9" dependencies = [ "bytes 0.5.6", "futures-channel", @@ -1299,7 +1297,7 @@ dependencies = [ "itoa", "pin-project 1.0.2", "socket2", - "tokio 0.2.23", + "tokio", "tower-service", "tracing", "want", @@ -1322,20 +1320,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "im" -version = "15.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "111c1983f3c5bb72732df25cddacee9b546d08325fb584b5ebd38148be7b0246" -dependencies = [ - "bitmaps", - "rand_core 0.5.1", - "rand_xoshiro", - "sized-chunks", - "typenum", - "version_check 0.9.2", -] - [[package]] name = "impl-codec" version = "0.4.2" @@ -1367,7 +1351,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48b0b7698c16bccca4617de8f9ede9f58ab44a68ad6b2a4920fd74e491de580d" dependencies = [ - "ahash", + "ahash 0.4.6", "itoa", "lazy_static", "log", @@ -1386,15 +1370,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - [[package]] name = "itoa" version = "0.4.6" @@ -1425,16 +1400,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -1447,6 +1412,19 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +[[package]] +name = "lexical-core" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db65c6da02e61f55dae90a0ae427b2a5f6b3e8db09f58d10efab23af92592616" +dependencies = [ + "arrayvec 0.5.2", + "bitflags", + "cfg-if 0.1.10", + "ryu", + "static_assertions", +] + [[package]] name = "libc" version = "0.2.80" @@ -1460,7 +1438,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" dependencies = [ "cc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1475,21 +1453,6 @@ dependencies = [ "libc", ] -[[package]] -name = "linked-hash-map" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" - -[[package]] -name = "lock_api" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] - [[package]] name = "lock_api" version = "0.4.2" @@ -1566,6 +1529,17 @@ dependencies = [ "metrics-core", ] +[[package]] +name = "metrics" +version = "0.13.0-alpha.8" +source = "git+https://github.com/ZcashFoundation/metrics?rev=971133128e5aebe3ad177acffc6154449736cfa2#971133128e5aebe3ad177acffc6154449736cfa2" +dependencies = [ + "beef", + "metrics-macros", + "proc-macro-hack", + "sharded-slab", +] + [[package]] name = "metrics-core" version = "0.5.2" @@ -1573,92 +1547,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c064b3a1ff41f4bf6c91185c8a0caeccf8a8a27e9d0f92cc54cf3dbec812f48" [[package]] -name = "metrics-exporter-http" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14017d204ae062dc5c68a321e3dbdcd9b30181305cb6b067932f7f03f754e27" +name = "metrics-exporter-prometheus" +version = "0.1.0-alpha.7" +source = "git+https://github.com/ZcashFoundation/metrics?rev=971133128e5aebe3ad177acffc6154449736cfa2#971133128e5aebe3ad177acffc6154449736cfa2" dependencies = [ + "hdrhistogram 7.1.0", "hyper", - "log", - "metrics-core", -] - -[[package]] -name = "metrics-exporter-log" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3fc63816bd5f8bde5eb31ce471f9633adc69ba1c55b44191b4d5fc7e263e8ab" -dependencies = [ - "log", - "metrics-core", - "tokio 0.2.23", -] - -[[package]] -name = "metrics-observer-json" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe930460a6c336b8f873dcfb28da3f805fd0dbadbea7beaf3042c7fb1d9fcd3" -dependencies = [ - "hdrhistogram", - "metrics-core", + "metrics 0.13.0-alpha.8", "metrics-util", - "serde_json", + "parking_lot", + "thiserror", + "tokio", ] [[package]] -name = "metrics-observer-prometheus" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bfe24ad8285ef8b239232135a65f89cc5fa4690bbfaf8907f4bef38f8b08eba" +name = "metrics-macros" +version = "0.1.0-alpha.5" +source = "git+https://github.com/ZcashFoundation/metrics?rev=971133128e5aebe3ad177acffc6154449736cfa2#971133128e5aebe3ad177acffc6154449736cfa2" dependencies = [ - "hdrhistogram", - "metrics-core", - "metrics-util", -] - -[[package]] -name = "metrics-observer-yaml" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83f66811013592560efc75d75a92d6e2f415a11b52f085e51d9fb4d1edec6335" -dependencies = [ - "hdrhistogram", - "metrics-core", - "metrics-util", - "serde_yaml", -] - -[[package]] -name = "metrics-runtime" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce0e4f69639ccc0c6b2f0612164f9817349eb25545ed1ffb5ef3e1e1c1d220b4" -dependencies = [ - "arc-swap", - "atomic-shim", - "crossbeam-utils 0.7.2", - "im", - "metrics", - "metrics-core", - "metrics-exporter-http", - "metrics-exporter-log", - "metrics-observer-json", - "metrics-observer-prometheus", - "metrics-observer-yaml", - "metrics-util", - "parking_lot 0.10.2", - "quanta", + "lazy_static", + "proc-macro-hack", + "proc-macro2 1.0.24", + "quote 1.0.7", + "regex", + "syn 1.0.48", ] [[package]] name = "metrics-util" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "277619f040719a5a23d75724586d5601286e8fa53451cfaaca3b8c627c2c2378" +version = "0.4.0-alpha.6" +source = "git+https://github.com/ZcashFoundation/metrics?rev=971133128e5aebe3ad177acffc6154449736cfa2#971133128e5aebe3ad177acffc6154449736cfa2" dependencies = [ - "crossbeam-epoch 0.8.2", - "serde", + "arc-swap", + "atomic-shim", + "crossbeam-epoch 0.9.0", + "crossbeam-utils 0.8.0", + "dashmap", + "indexmap", + "metrics 0.13.0-alpha.8", ] [[package]] @@ -1671,25 +1597,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "mio" -version = "0.6.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow 0.2.1", - "net2", - "slab", - "winapi 0.2.8", -] - [[package]] name = "mio" version = "0.7.6" @@ -1698,21 +1605,9 @@ checksum = "f33bc887064ef1fd66020c9adfc45bb9f33d75a42096c81e7c56c65b75dd1a8b" dependencies = [ "libc", "log", - "miow 0.3.6", + "miow", "ntapi", - "winapi 0.3.9", -] - -[[package]] -name = "miow" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", + "winapi", ] [[package]] @@ -1722,18 +1617,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" dependencies = [ "socket2", - "winapi 0.3.9", -] - -[[package]] -name = "net2" -version = "0.2.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1758,6 +1642,7 @@ version = "5.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" dependencies = [ + "lexical-core", "memchr", "version_check 0.9.2", ] @@ -1768,7 +1653,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1840,7 +1725,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1870,16 +1755,6 @@ dependencies = [ "serde", ] -[[package]] -name = "parking_lot" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" -dependencies = [ - "lock_api 0.3.4", - "parking_lot_core 0.7.2", -] - [[package]] name = "parking_lot" version = "0.11.1" @@ -1887,22 +1762,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ "instant", - "lock_api 0.4.2", - "parking_lot_core 0.8.0", -] - -[[package]] -name = "parking_lot_core" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi 0.0.3", - "libc", - "redox_syscall", - "smallvec 1.5.0", - "winapi 0.3.9", + "lock_api", + "parking_lot_core", ] [[package]] @@ -1912,12 +1773,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" dependencies = [ "cfg-if 0.1.10", - "cloudabi 0.1.0", + "cloudabi", "instant", "libc", "redox_syscall", "smallvec 1.5.0", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2104,18 +1965,6 @@ dependencies = [ "syn 0.15.44", ] -[[package]] -name = "quanta" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21484fda3d8ad7affee37755c77a5d0da527543f0af0c7f731c14e2215645d39" -dependencies = [ - "atomic-shim", - "ctor", - "libc", - "winapi 0.3.9", -] - [[package]] name = "quick-error" version = "1.2.3" @@ -2171,7 +2020,7 @@ dependencies = [ "libc", "rand_core 0.3.1", "rdrand", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2239,15 +2088,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rand_xoshiro" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9fcdd2e881d02f1d9390ae47ad8e5696a9e4be7b547a1da2afbc61973217004" -dependencies = [ - "rand_core 0.5.1", -] - [[package]] name = "rayon" version = "1.5.0" @@ -2348,7 +2188,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2536,18 +2376,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_yaml" -version = "0.8.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7baae0a99f1a324984bcdc5f0718384c1f69775f1c7eec8b859b71b443e3fd7" -dependencies = [ - "dtoa", - "linked-hash-map", - "serde", - "yaml-rust", -] - [[package]] name = "sha2" version = "0.9.2" @@ -2596,16 +2424,6 @@ dependencies = [ "libc", ] -[[package]] -name = "sized-chunks" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec31ceca5644fa6d444cc77548b88b67f46db6f7c71683b0f9336e671830d2f" -dependencies = [ - "bitmaps", - "typenum", -] - [[package]] name = "slab" version = "0.4.2" @@ -2636,7 +2454,7 @@ dependencies = [ "cfg-if 0.1.10", "libc", "redox_syscall", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2776,7 +2594,7 @@ dependencies = [ "rand 0.7.3", "redox_syscall", "remove_dir_all", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2834,7 +2652,7 @@ checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2852,23 +2670,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" -[[package]] -name = "tokio" -version = "0.2.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6d7ad61edd59bfcc7e80dababf0f4aed2e6d5e0ba1659356ae889752dfc12ff" -dependencies = [ - "bytes 0.5.6", - "fnv", - "futures-core", - "iovec", - "lazy_static", - "memchr", - "mio 0.6.22", - "pin-project-lite 0.1.11", - "slab", -] - [[package]] name = "tokio" version = "0.3.4" @@ -2881,15 +2682,15 @@ dependencies = [ "lazy_static", "libc", "memchr", - "mio 0.7.6", + "mio", "num_cpus", - "parking_lot 0.11.1", + "parking_lot", "pin-project-lite 0.2.0", "signal-hook-registry", "slab", "tokio-macros", "tracing", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2905,16 +2706,16 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +checksum = "24793699f4665ba0416ed287dc794fe6b11a4aa5e4e95b58624f45f6c46b97d4" dependencies = [ "bytes 0.5.6", "futures-core", "futures-sink", "log", "pin-project-lite 0.1.11", - "tokio 0.2.23", + "tokio", ] [[package]] @@ -2928,7 +2729,7 @@ dependencies = [ "futures-sink", "log", "pin-project-lite 0.1.11", - "tokio 0.3.4", + "tokio", ] [[package]] @@ -2947,9 +2748,9 @@ source = "git+https://github.com/tower-rs/tower?rev=5e1e07744820028877654c336a3b dependencies = [ "futures-core", "futures-util", - "hdrhistogram", + "hdrhistogram 6.3.4", "pin-project 1.0.2", - "tokio 0.3.4", + "tokio", "tower-layer", "tower-service", "tracing", @@ -2965,7 +2766,7 @@ dependencies = [ "futures-core", "pin-project 0.4.27", "rand 0.7.3", - "tokio 0.3.4", + "tokio", "tower", "tower-fallback", "tracing", @@ -2979,7 +2780,7 @@ version = "0.1.0" dependencies = [ "futures-core", "pin-project 0.4.27", - "tokio 0.3.4", + "tokio", "tower", "tracing", "zebra-test", @@ -3268,12 +3069,6 @@ dependencies = [ "libc", ] -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - [[package]] name = "winapi" version = "0.3.9" @@ -3284,12 +3079,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -3302,7 +3091,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3311,16 +3100,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "wyz" version = "0.2.0" @@ -3339,15 +3118,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "yaml-rust" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39f0c922f1a334134dc2f7a8b67dc5d25f0735263feec974345ff706bcf20b0d" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "zcash_script" version = "0.1.4" @@ -3412,14 +3182,14 @@ dependencies = [ "futures", "futures-util", "jubjub 0.5.1", - "metrics", + "metrics 0.12.1", "once_cell", "rand 0.7.3", "redjubjub", "serde", "spandoc", "thiserror", - "tokio 0.3.4", + "tokio", "tower", "tower-batch", "tower-fallback", @@ -3445,14 +3215,14 @@ dependencies = [ "futures", "hex", "indexmap", - "metrics", + "metrics 0.12.1", "pin-project 0.4.27", "proptest", "proptest-derive", "rand 0.7.3", "serde", "thiserror", - "tokio 0.3.4", + "tokio", "tokio-util 0.5.0", "tower", "tracing", @@ -3489,7 +3259,7 @@ dependencies = [ "futures", "hex", "lazy_static", - "metrics", + "metrics 0.12.1", "once_cell", "primitive-types", "proptest", @@ -3498,7 +3268,7 @@ dependencies = [ "spandoc", "tempdir", "thiserror", - "tokio 0.3.4", + "tokio", "tower", "tracing", "tracing-error", @@ -3521,7 +3291,7 @@ dependencies = [ "spandoc", "tempdir", "thiserror", - "tokio 0.3.4", + "tokio", "tower", "tracing", "tracing-error", @@ -3555,15 +3325,15 @@ dependencies = [ "gumdrop", "hyper", "inferno", - "metrics", - "metrics-runtime", + "metrics 0.13.0-alpha.8", + "metrics-exporter-prometheus", "once_cell", "pin-project 0.4.27", "rand 0.7.3", "serde", "tempdir", "thiserror", - "tokio 0.3.4", + "tokio", "toml", "tower", "tracing", diff --git a/Cargo.toml b/Cargo.toml index 1eb6e23e..5c9e4ac6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,3 +22,7 @@ panic = "abort" [patch.crates-io] tower = { git = "https://github.com/tower-rs/tower", rev = "5e1e07744820028877654c336a3b9fe057bf46f1" } +hyper = { git = "https://github.com/hyperium/hyper/", rev = "ed2b22a7f66899d338691552fbcb6c0f2f4e06b9" } +metrics = { git = "https://github.com/ZcashFoundation/metrics", rev = "971133128e5aebe3ad177acffc6154449736cfa2" } +metrics-exporter-prometheus = { git = "https://github.com/ZcashFoundation/metrics", rev = "971133128e5aebe3ad177acffc6154449736cfa2" } + diff --git a/zebrad/Cargo.toml b/zebrad/Cargo.toml index 49b8452a..96d2ea7b 100644 --- a/zebrad/Cargo.toml +++ b/zebrad/Cargo.toml @@ -19,7 +19,7 @@ toml = "0.5" chrono = "0.4" rand = "0.7" -hyper = "0.13.9" +hyper = { version = "0.14.0-dev", features = ["full"] } futures = "0.3" tokio = { version = "0.3", features = ["time", "rt-multi-thread", "stream", "macros", "tracing", "signal"] } tower = { version = "0.4", features = ["hedge", "limit"] } @@ -33,8 +33,8 @@ tracing-futures = "0.2" tracing-flame = "0.1.0" tracing-subscriber = { version = "0.2.15", features = ["tracing-log"] } tracing-error = "0.1.2" -metrics-runtime = "0.13" -metrics = "0.12" +metrics = "0.13.0-alpha.8" +metrics-exporter-prometheus = "0.1.0-alpha.7" dirs = "3.0.1" inferno = { version = "0.10.1", default-features = false } diff --git a/zebrad/src/components/metrics.rs b/zebrad/src/components/metrics.rs index af003839..83963f3c 100644 --- a/zebrad/src/components/metrics.rs +++ b/zebrad/src/components/metrics.rs @@ -1,54 +1,23 @@ //! An HTTP endpoint for metrics collection. -use std::net::SocketAddr; - use abscissa_core::{Component, FrameworkError}; -use metrics_runtime::{exporters::HttpExporter, observers::PrometheusBuilder, Receiver}; -use crate::{components::tokio::TokioComponent, config::ZebradConfig}; +use crate::config::ZebradConfig; /// Abscissa component which runs a metrics endpoint. #[derive(Debug, Component)] -#[component(inject = "init_tokio(zebrad::components::tokio::TokioComponent)")] -pub struct MetricsEndpoint { - addr: Option, -} +pub struct MetricsEndpoint {} impl MetricsEndpoint { /// Create the component. pub fn new(config: &ZebradConfig) -> Result { - Ok(Self { - addr: config.metrics.endpoint_addr, - }) - } - - /// Tokio endpoint dependency stub. - pub fn init_tokio(&mut self, tokio_component: &TokioComponent) -> Result<(), FrameworkError> { - let addr = if let Some(addr) = self.addr { - addr - } else { - return Ok(()); - }; - - info!("Initializing metrics endpoint at {}", addr); - - // XXX do we need to hold on to the receiver? - let receiver = Receiver::builder() - .build() - .expect("Receiver config should be valid"); - // XXX ???? connect this ??? - let _sink = receiver.sink(); - - let endpoint = HttpExporter::new(receiver.controller(), PrometheusBuilder::new(), addr); - - tokio_component - .rt - .as_ref() - .expect("runtime should not be taken") - .spawn(endpoint.async_run()); - - metrics::set_boxed_recorder(Box::new(receiver)).expect("XXX FIXME ERROR CONVERSION"); - - Ok(()) + if let Some(addr) = config.metrics.endpoint_addr { + info!("Initializing metrics endpoint at {}", addr); + metrics_exporter_prometheus::PrometheusBuilder::new() + .listen_address(addr) + .install() + .expect("FIXME ERROR CONVERSION"); + } + Ok(Self {}) } } diff --git a/zebrad/src/components/sync.rs b/zebrad/src/components/sync.rs index 1cbf944c..d49738db 100644 --- a/zebrad/src/components/sync.rs +++ b/zebrad/src/components/sync.rs @@ -557,11 +557,11 @@ where fn update_metrics(&self) { metrics::gauge!( "sync.prospective_tips.len", - self.prospective_tips.len() as i64 + self.prospective_tips.len() as f64 ); metrics::gauge!( "sync.downloads.in_flight", - self.downloads.in_flight() as i64 + self.downloads.in_flight() as f64 ); } }