From b0a183fb10dc70b3bd1084acb73ef348e8000f69 Mon Sep 17 00:00:00 2001 From: Marcelo Fornet Date: Fri, 5 Jun 2020 14:41:32 -0400 Subject: [PATCH] feat: Rework metrics usage. Bulding dashboard Expose validator_id in rpc Use strum (instead of named_enum) --- Cargo.lock | 551 +++++++++++++++--------------- chain/client/src/client_actor.rs | 6 + chain/client/src/info.rs | 9 + chain/client/src/metrics.rs | 18 +- chain/network/Cargo.toml | 1 + chain/network/src/metrics.rs | 141 ++++---- chain/network/src/peer.rs | 13 +- chain/network/src/peer_manager.rs | 14 +- chain/network/src/routing.rs | 11 +- chain/network/src/types.rs | 264 ++------------ core/metrics/src/lib.rs | 12 + core/primitives/src/views.rs | 2 + 12 files changed, 455 insertions(+), 587 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ec6fd0138b7..7072969d42a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -86,7 +86,7 @@ dependencies = [ "actix-threadpool", "actix-tls", "actix-utils", - "base64", + "base64 0.11.0", "bitflags", "brotli2", "bytes", @@ -123,9 +123,9 @@ dependencies = [ [[package]] name = "actix-macros" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21705adc76bbe4bc98434890e73a89cd00c6015e5704a60bb6eea6c3b72316b6" +checksum = "a60f9ba7c4e6df97f3aacb14bb5c0cd7d98a49dcbaed0d7f292912ad9a6a3ed2" dependencies = [ "quote", "syn", @@ -161,21 +161,22 @@ dependencies = [ [[package]] name = "actix-server" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "582a7173c281a4f46b5aa168a11e7f37183dcb71177a39312cc2264da7a632c9" +checksum = "e6d74b464215a473c973a2d7d03a69cc10f4ce1f4b38a7659c5193dc5c675630" dependencies = [ "actix-codec", "actix-rt", "actix-service", "actix-utils", - "futures", + "futures-channel", + "futures-util", "log", "mio", "mio-uds", - "net2", "num_cpus", "slab", + "socket2", ] [[package]] @@ -190,24 +191,23 @@ dependencies = [ [[package]] name = "actix-testing" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48494745b72d0ea8ff0cf874aaf9b622a3ee03d7081ee0c04edea4f26d32c911" +checksum = "47239ca38799ab74ee6a8a94d1ce857014b2ac36f242f70f3f75a66f691e791c" dependencies = [ "actix-macros", "actix-rt", "actix-server", "actix-service", - "futures", "log", - "net2", + "socket2", ] [[package]] name = "actix-threadpool" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4082192601de5f303013709ff84d81ca6a1bc4af7fb24f367a500a23c6e84e" +checksum = "91164716d956745c79dcea5e66d2aa04506549958accefcede5368c70f2fd4ff" dependencies = [ "derive_more", "futures-channel", @@ -293,9 +293,9 @@ dependencies = [ [[package]] name = "actix-web-codegen" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f00371942083469785f7e28c540164af1913ee7c96a4534acb9cea92c39f057" +checksum = "a71bf475cbe07281d0b3696abb48212db118e7e23219f13596ce865235ff5766" dependencies = [ "proc-macro2", "quote", @@ -313,6 +313,15 @@ dependencies = [ "syn", ] +[[package]] +name = "addr2line" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a49806b9dadc843c61e7c97e72490ad7f7220ae249012fbda9ad0609457c0543" +dependencies = [ + "gimli", +] + [[package]] name = "adler32" version = "1.0.4" @@ -339,9 +348,9 @@ dependencies = [ [[package]] name = "arc-swap" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b585a98a234c46fc563103e9278c9391fde1f4e6850334da895d27edb9580f62" +checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" [[package]] name = "arrayref" @@ -363,9 +372,9 @@ checksum = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5" [[package]] name = "async-trait" -version = "0.1.30" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da71fef07bc806586090247e971229289f64c210a278ee5ae419314eb386b31d" +checksum = "89cb5d814ab2a47fd66d3266e9efccb53ca4c740b7451043b8ffcf9a6208f3f8" dependencies = [ "proc-macro2", "quote", @@ -405,7 +414,7 @@ dependencies = [ "actix-http", "actix-rt", "actix-service", - "base64", + "base64 0.11.0", "bytes", "derive_more", "futures-core", @@ -421,31 +430,28 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.46" +version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e692897359247cc6bb902933361652380af0f1b7651ae5c5013407f30e109e" +checksum = "0df2f85c8a2abbe3b7d7e748052fdd9b76a0458fdeb16ad4223f5eca78c7c130" dependencies = [ - "backtrace-sys", + "addr2line", "cfg-if", "libc", + "object", "rustc-demangle", ] [[package]] -name = "backtrace-sys" -version = "0.1.36" +name = "base64" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78848718ee1255a2485d1309ad9cdecfc2e7d0362dd11c6829364c6b35ae1bc7" -dependencies = [ - "cc", - "libc", -] +checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" [[package]] name = "base64" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" +checksum = "53d1ccbaf7d9ec9537465a97bf19edc1a4e158ecb49fc16178202238c569cc42" [[package]] name = "bencher" @@ -465,9 +471,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.53.2" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb26d6a69a335b8cb0e7c7e9775cd5666611dc50a37177c3f2cedcfc040e8c8" +checksum = "c72a978d268b1d70b0e963217e60fdabd9523a941457a6c42a7315d15c7e89e5" dependencies = [ "bitflags", "cexpr", @@ -622,9 +628,9 @@ checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" [[package]] name = "bstr" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2889e6d50f394968c8bf4240dc3f2a7eb4680844d27308f798229ac9d4725f41" +checksum = "31accafdb70df7871592c058eca3985b71104e15ac32f64706022c58867da931" dependencies = [ "lazy_static", "memchr", @@ -634,9 +640,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.2.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187" +checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" [[package]] name = "byte-tools" @@ -667,9 +673,9 @@ dependencies = [ [[package]] name = "c2-chacha" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" +checksum = "217192c943108d8b13bac38a1d51df9ce8a407a3f5a71ab633980665e68fbd9a" dependencies = [ "byteorder", "ppv-lite86", @@ -687,9 +693,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.52" +version = "1.0.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d87b23d6a92cd03af510a5ade527033f6aa6fa92161e2d5863a907d4c5e31d" +checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311" dependencies = [ "jobserver", ] @@ -734,9 +740,9 @@ dependencies = [ [[package]] name = "clap" -version = "2.33.0" +version = "2.33.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" +checksum = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129" dependencies = [ "ansi_term", "atty", @@ -749,25 +755,13 @@ dependencies = [ [[package]] name = "clear_on_drop" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97276801e127ffb46b66ce23f35cc96bd454fa311294bced4bbace7baa8b1d17" +checksum = "c9cc5db465b294c3fa986d5bbb0f3017cd850bff6dd6c52f9ccff8b4d21b7b08" dependencies = [ "cc", ] -[[package]] -name = "clicolors-control" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e" -dependencies = [ - "atty", - "lazy_static", - "libc", - "winapi 0.3.8", -] - [[package]] name = "cloudabi" version = "0.0.3" @@ -779,27 +773,28 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.42" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fb25b677f8bf1eb325017cb6bb8452f87969db0fedb4f757b297bee78a7c62" +checksum = "0e56268c17a6248366d66d4a47a3381369d068cce8409bb1716ed77ea32163bb" dependencies = [ "cc", ] [[package]] name = "console" -version = "0.10.0" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6728a28023f207181b193262711102bfbaf47cc9d13bc71d0736607ef8efe88c" +checksum = "8c0994e656bba7b922d8dd1245db90672ffb701e684e45be58f20719d69abc5a" dependencies = [ - "clicolors-control", "encode_unicode", "lazy_static", "libc", "regex", + "terminal_size", "termios", "unicode-width", "winapi 0.3.8", + "winapi-util", ] [[package]] @@ -810,9 +805,9 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "copyless" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff9c56c9fb2a49c05ef0e431485a22400af20d33226dc0764d891d09e724127" +checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" [[package]] name = "core-foundation" @@ -877,9 +872,9 @@ dependencies = [ [[package]] name = "crossbeam-queue" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db" +checksum = "ab6bffe714b6bb07e42f201352c34f51fefd355ace793f9e638ebd52d23f98d2" dependencies = [ "cfg-if", "crossbeam-utils", @@ -934,33 +929,24 @@ dependencies = [ "memchr", ] -[[package]] -name = "ct-logs" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d3686f5fa27dbc1d76c751300376e167c5a43387f44bb451fd1c24776e49113" -dependencies = [ - "sct", -] - [[package]] name = "curve25519-dalek" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26778518a7f6cffa1d25a44b602b62b979bd88adb9e99ffec546998cf3404839" +checksum = "5d85653f070353a16313d0046f173f70d1aadd5b42600a14de626f0dfb3473a5" dependencies = [ "byteorder", "digest", "rand_core 0.5.1", - "subtle 2.2.2", + "subtle 2.2.3", "zeroize", ] [[package]] name = "derive_more" -version = "0.99.5" +version = "0.99.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2323f3f47db9a0e77ce7a300605d8d2098597fc451ed1a97bb1f6411bb550a7" +checksum = "2127768764f1556535c01b5326ef94bd60ff08dcfbdc544d53e69ed155610f5d" dependencies = [ "proc-macro2", "quote", @@ -988,11 +974,10 @@ dependencies = [ [[package]] name = "dirs-sys" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b" +checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" dependencies = [ - "cfg-if", "libc", "redox_users", "winapi 0.3.8", @@ -1080,9 +1065,9 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "encoding_rs" -version = "0.8.22" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d03faa7fe0c1431609dfad7bbe827af30f82e1e2ae6f7ee4fca6bd764bc28" +checksum = "e8ac63f94732332f44fe654443c46f6375d1939684c17b0afb6cb56b0456e171" dependencies = [ "cfg-if", ] @@ -1135,9 +1120,9 @@ dependencies = [ [[package]] name = "failure" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8529c2421efa3066a5cbd8063d2244603824daccb6936b079010bb2aa89464b" +checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" dependencies = [ "backtrace", "failure_derive", @@ -1145,9 +1130,9 @@ dependencies = [ [[package]] name = "failure_derive" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231" +checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ "proc-macro2", "quote", @@ -1163,9 +1148,9 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "fixed-hash" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32529fc42e86ec06e5047092082aab9ad459b070c5d2a76b14f4f5ce70bf2e84" +checksum = "11498d382790b7a8f2fd211780bec78619bba81cdad3a283997c0c41f836759c" dependencies = [ "static_assertions", ] @@ -1184,9 +1169,9 @@ dependencies = [ [[package]] name = "fnv" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foreign-types" @@ -1227,9 +1212,9 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" [[package]] name = "futures" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c329ae8753502fb44ae4fc2b622fa2a94652c41e795143765ba0927f92ab780" +checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" dependencies = [ "futures-channel", "futures-core", @@ -1242,9 +1227,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8" +checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" dependencies = [ "futures-core", "futures-sink", @@ -1252,15 +1237,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a" +checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" [[package]] name = "futures-executor" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f674f3e1bcb15b37284a90cedf55afdba482ab061c407a9c0ebbd0f3109741ba" +checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" dependencies = [ "futures-core", "futures-task", @@ -1269,15 +1254,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a638959aa96152c7a4cddf50fcb1e3fede0583b27157c26e67d6f99904090dc6" +checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" [[package]] name = "futures-macro" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" +checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" dependencies = [ "proc-macro-hack", "proc-macro2", @@ -1287,21 +1272,24 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3466821b4bc114d95b087b850a724c6f83115e929bc88f1fa98a3304a944c8a6" +checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" [[package]] name = "futures-task" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27" +checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" +dependencies = [ + "once_cell", +] [[package]] name = "futures-util" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5" +checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" dependencies = [ "futures-channel", "futures-core", @@ -1310,6 +1298,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", + "pin-project", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -1392,6 +1381,12 @@ dependencies = [ "wasi", ] +[[package]] +name = "gimli" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c" + [[package]] name = "git-version" version = "0.3.4" @@ -1437,9 +1432,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377038bf3c89d18d6ca1431e7a5027194fbd724ca10592b9487ede5e8e144f42" +checksum = "79b7246d7e4b979c03fa093da39cfb3617a96bbeee6310af63991668d7e843ff" dependencies = [ "bytes", "fnv", @@ -1474,9 +1469,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.11" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d737e0f947a1864e93d33fdef4af8445a00d1ed8dc0c8ddb73139ea6abf15" +checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71" dependencies = [ "libc", ] @@ -1499,9 +1494,9 @@ dependencies = [ [[package]] name = "hex-literal-impl" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d4c5c844e2fee0bf673d54c2c177f1713b3d2af2ff6e666b49cb7572e6cf42d" +checksum = "853f769599eb31de176303197b7ba4973299c38c7a7604a6bc88c3eef05b9b46" dependencies = [ "proc-macro-hack", ] @@ -1555,9 +1550,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.13.5" +version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96816e1d921eca64d208a85aab4f7798455a8e34229ee5a88c935bdee1b78b14" +checksum = "a6e7655b9594024ad0ee439f3b5a7299369dc2a3f459b47c696f9ff676f9aa1f" dependencies = [ "bytes", "futures-channel", @@ -1569,8 +1564,8 @@ dependencies = [ "httparse", "itoa", "log", - "net2", "pin-project", + "socket2", "time", "tokio", "tower-service", @@ -1584,12 +1579,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac965ea399ec3a25ac7d13b8affd4b8f39325cca00858ddf5eb29b79e6b14b08" dependencies = [ "bytes", - "ct-logs", "futures-util", "hyper", "log", "rustls", - "rustls-native-certs", "tokio", "tokio-rustls", "webpki", @@ -1627,9 +1620,9 @@ checksum = "c3360c7b59e5ffa2653671fb74b4741a5d343c03f331c0a4aeda42b5c2b0ec7d" [[package]] name = "indexmap" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292" +checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe" dependencies = [ "autocfg 1.0.0", "serde", @@ -1671,14 +1664,14 @@ dependencies = [ [[package]] name = "ipconfig" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa79fa216fbe60834a9c0737d7fcd30425b32d1c58854663e24d4c4b328ed83f" +checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" dependencies = [ "socket2", "widestring", "winapi 0.3.8", - "winreg", + "winreg 0.6.2", ] [[package]] @@ -1719,9 +1712,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.37" +version = "0.3.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a27d435371a2fa5b6d2b028a74bbdb1234f308da363226a2854ca3ff8ba7055" +checksum = "ce10c23ad2ea25ceca0093bd3192229da4c5b3c0f2de499c1ecac0d98d452177" dependencies = [ "wasm-bindgen", ] @@ -1771,9 +1764,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" [[package]] name = "libc" -version = "0.2.69" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005" +checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" [[package]] name = "libloading" @@ -1799,9 +1792,9 @@ dependencies = [ [[package]] name = "linked-hash-map" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" +checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" [[package]] name = "loadtester" @@ -1924,18 +1917,18 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa679ff6578b1cddee93d7e82e263b94a575e0bfced07284eb0c037c1d2416a5" +checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" dependencies = [ "adler32", ] [[package]] name = "mio" -version = "0.6.21" +version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" +checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" dependencies = [ "cfg-if", "fuchsia-zircon", @@ -1958,15 +1951,15 @@ checksum = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3" dependencies = [ "log", "mio", - "miow 0.3.3", + "miow 0.3.5", "winapi 0.3.8", ] [[package]] name = "mio-uds" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" dependencies = [ "iovec", "libc", @@ -1987,9 +1980,9 @@ dependencies = [ [[package]] name = "miow" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" +checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" dependencies = [ "socket2", "winapi 0.3.8", @@ -2138,7 +2131,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "subtle 2.2.2", + "subtle 2.2.3", ] [[package]] @@ -2256,6 +2249,7 @@ dependencies = [ "rand 0.7.3", "serde", "serde_json", + "strum", "tempfile", "tokio", "tokio-util 0.2.0", @@ -2276,7 +2270,7 @@ dependencies = [ name = "near-primitives" version = "0.1.0" dependencies = [ - "base64", + "base64 0.11.0", "bencher", "borsh", "bs58", @@ -2402,7 +2396,7 @@ dependencies = [ name = "near-vm-logic" version = "0.9.1" dependencies = [ - "base64", + "base64 0.11.0", "bs58", "byteorder", "near-runtime-fees", @@ -2434,7 +2428,7 @@ dependencies = [ name = "near-vm-runner-standalone" version = "0.9.1" dependencies = [ - "base64", + "base64 0.11.0", "clap", "near-runtime-fees", "near-vm-logic", @@ -2510,9 +2504,9 @@ dependencies = [ [[package]] name = "net2" -version = "0.2.33" +version = "0.2.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" +checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" dependencies = [ "cfg-if", "libc", @@ -2537,7 +2531,7 @@ name = "node-runtime" version = "0.9.0" dependencies = [ "assert_matches", - "base64", + "base64 0.11.0", "borsh", "byteorder", "cached", @@ -2577,9 +2571,9 @@ dependencies = [ [[package]] name = "ntapi" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26e041cd983acbc087e30fcba770380cfa352d0e392e175b2344ebaf7ea0602" +checksum = "7a31937dea023539c72ddae0e3571deadc1414b300483fa7aaec176168cfa9d2" dependencies = [ "winapi 0.3.8", ] @@ -2643,6 +2637,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" +[[package]] +name = "object" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cbca9424c482ee628fa549d9c812e2cd22f1180b9222c9200fdfa6eb31aecb2" + [[package]] name = "once_cell" version = "1.4.0" @@ -2677,18 +2677,18 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" [[package]] name = "openssl-src" -version = "111.9.0+1.1.1g" +version = "111.10.0+1.1.1g" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2dbe10ddd1eb335aba3780eb2eaa13e1b7b441d2562fd962398740927f39ec4" +checksum = "47cd4a96d49c3abf4cac8e8a80cba998a030c75608f158fb1c5f609772f265e6" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.55" +version = "0.9.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7717097d810a0f2e2323f9e5d11e71608355e24828410b55b9d4f18aa5f9a5d8" +checksum = "a842db4709b604f0fe5d1170ae3565899be2ad3d9cbc72dedc789ac0511f78de" dependencies = [ "autocfg 1.0.0", "cc", @@ -2773,18 +2773,18 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" -version = "0.4.9" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f6a7f5eee6292c559c793430c55c00aea9d3b3d1905e855806ca4d7253426a2" +checksum = "e75373ff9037d112bb19bc61333a06a159eaeb217660dcfbea7d88e1db823919" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.9" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8988430ce790d8682672117bc06dda364c0be32d3abd738234f19f3240bad99a" +checksum = "10b4b44893d3c370407a1d6a5cfde7c41ae0478e31c516c85f67eb3adc51be6d" dependencies = [ "proc-macro2", "quote", @@ -2793,9 +2793,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237844750cfbb86f67afe27eee600dfbbcb6188d734139b534cbfbf4f96792ae" +checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" [[package]] name = "pin-utils" @@ -2811,15 +2811,15 @@ checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" [[package]] name = "ppv-lite86" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" +checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" [[package]] name = "primitive-types" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5e4b9943a2da369aec5e96f7c10ebc74fcf434d39590d974b0a3460e6f67fbb" +checksum = "c55c21c64d0eaa4d7ed885d959ef2d62d9e488c27c0e02d9aa5ce6c877b7d5f8" dependencies = [ "fixed-hash", "uint", @@ -2827,21 +2827,21 @@ dependencies = [ [[package]] name = "proc-macro-hack" -version = "0.5.15" +version = "0.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63" +checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" [[package]] name = "proc-macro-nested" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" +checksum = "0afe1bd463b9e9ed51d0e0f0b50b6b146aec855c56fd182bb242388710a9b6de" [[package]] name = "proc-macro2" -version = "1.0.10" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3" +checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" dependencies = [ "unicode-xid", ] @@ -2885,9 +2885,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.3" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" +checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" dependencies = [ "proc-macro2", ] @@ -3085,9 +3085,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.3.7" +version = "1.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692" +checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" dependencies = [ "aho-corasick", "memchr", @@ -3107,9 +3107,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.17" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae" +checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" [[package]] name = "remove_dir_all" @@ -3122,11 +3122,11 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.10.4" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b81e49ddec5109a9dcfc5f2a317ff53377c915e9ae9d4f2fb50914b85614e2" +checksum = "3b82c9238b305f26f53443e3a4bc8528d64b8d0bee408ec949eb7bf5635ec680" dependencies = [ - "base64", + "base64 0.12.1", "bytes", "encoding_rs", "futures-core", @@ -3148,7 +3148,6 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "time", "tokio", "tokio-rustls", "tokio-tls", @@ -3157,7 +3156,7 @@ dependencies = [ "wasm-bindgen-futures", "web-sys", "webpki-roots", - "winreg", + "winreg 0.7.0", ] [[package]] @@ -3186,13 +3185,13 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.12" +version = "0.16.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba5a8ec64ee89a76c98c549af81ff14813df09c3e6dc4766c3856da48597a0c" +checksum = "06b3fefa4f12272808f809a0af618501fdaba41a58963c5fb72238ab0be09603" dependencies = [ "cc", - "lazy_static", "libc", + "once_cell", "spin", "untrusted", "web-sys", @@ -3239,7 +3238,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017" dependencies = [ - "base64", + "base64 0.11.0", "blake2b_simd", "constant_time_eq", "crossbeam-utils", @@ -3278,36 +3277,24 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0d4a31f5d68413404705d6982529b0e11a9aacd4839d1d6222ee3b8cb4015e1" dependencies = [ - "base64", + "base64 0.11.0", "log", "ring", "sct", "webpki", ] -[[package]] -name = "rustls-native-certs" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75ffeb84a6bd9d014713119542ce415db3a3e4748f0bfce1e1416cd224a23a5" -dependencies = [ - "openssl-probe", - "rustls", - "schannel", - "security-framework", -] - [[package]] name = "ryu" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] name = "schannel" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "039c25b130bd8c1321ee2d7de7fde2659fa9c2744e4bb29711cfc852ea53cd19" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", "winapi 0.3.8", @@ -3331,9 +3318,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f331b9025654145cd425b9ded0caf8f5ae0df80d418b326e2dc1c3dc5eb0620" +checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535" dependencies = [ "bitflags", "core-foundation", @@ -3369,9 +3356,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.106" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" +checksum = "c9124df5b40cbd380080b2cc6ab894c040a3070d995f5c9dc77e18c34a8ae37d" dependencies = [ "serde_derive", ] @@ -3388,18 +3375,18 @@ dependencies = [ [[package]] name = "serde_bytes" -version = "0.11.3" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "325a073952621257820e7a3469f55ba4726d8b28657e7e36653d1c36dc2c84ae" +checksum = "3bf487fbf5c6239d7ea2ff8b10cb6b811cd4b5080d1c2aeed1dec18753c06e10" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.106" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c" +checksum = "3f2c3ac8e6ca1e9c80b8be1023940162bf81ae3cffbb1809474152f2ce1eb250" dependencies = [ "proc-macro2", "quote", @@ -3408,9 +3395,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.51" +version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da07b57ee2623368351e9a0488bb0b261322a15a6e0ae53e243cbdc0f4208da9" +checksum = "ec2c5d7e739bc07a3e73381a39d61fdb5f671c60c1df26a130690665803d8226" dependencies = [ "indexmap", "itoa", @@ -3438,9 +3425,9 @@ checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0" +checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" dependencies = [ "block-buffer", "digest", @@ -3620,15 +3607,15 @@ checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" [[package]] name = "subtle" -version = "2.2.2" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c65d530b10ccaeac294f349038a597e435b18fb456aadd0840a623f83b9e941" +checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" [[package]] name = "syn" -version = "1.0.18" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "410a7488c0a728c7ceb4ad59b9567eb4053d02e8cc7f5c0e0eeeb39518369213" +checksum = "b5304cfdf27365b7585c25d4af91b35016ed21ef88f17ced89c7093b43dba8b6" dependencies = [ "proc-macro2", "quote", @@ -3637,9 +3624,9 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" +checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" dependencies = [ "proc-macro2", "quote", @@ -3690,6 +3677,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8038f95fc7a6f351163f4b964af631bd26c9e828f7db085f2a84aca56f70d13b" +dependencies = [ + "libc", + "winapi 0.3.8", +] + [[package]] name = "termios" version = "0.3.2" @@ -3742,18 +3739,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.15" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b3d3d2ff68104100ab257bb6bb0cb26c901abe4bd4ba15961f3bf867924012" +checksum = "b13f926965ad00595dd129fa12823b04bbf866e9085ab0a5f2b05b850fbfc344" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.15" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca972988113b7715266f91250ddb98070d033c62a011fa0fcc57434a649310dd" +checksum = "893582086c2f98cde18f906265a65b5030a074b1046c674ae898be6519a7f479" dependencies = [ "proc-macro2", "quote", @@ -3771,9 +3768,9 @@ dependencies = [ [[package]] name = "threadpool" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8dae184447c15d5a6916d973c642aec485105a13cd238192a6927ae3e077d66" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" dependencies = [ "num_cpus", ] @@ -3790,9 +3787,9 @@ dependencies = [ [[package]] name = "tokio" -version = "0.2.18" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ef16d072d2b6dc8b4a56c70f5c5ced1a37752116f8e7c1e80c659aa7cb6713" +checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" dependencies = [ "bytes", "fnv", @@ -3835,9 +3832,9 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4adb8b3e5f86b707f1b54e7c15b6de52617a823608ccda98a15d3a24222f265a" +checksum = "15cb62a0d2770787abc96e99c1cd98fcf17f94959f3af63ca85bdfb203f051b4" dependencies = [ "futures-core", "rustls", @@ -3847,9 +3844,9 @@ dependencies = [ [[package]] name = "tokio-tls" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bde02a3a5291395f59b06ec6945a3077602fac2b07eeeaf0dee2122f3619828" +checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" dependencies = [ "native-tls", "tokio", @@ -3891,9 +3888,9 @@ checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" [[package]] name = "tracing" -version = "0.1.13" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1721cc8cf7d770cc4257872507180f35a4797272f5962f24c806af9e7faf52ab" +checksum = "a41f40ed0e162c911ac6fcb53ecdc8134c46905fdbbae8c50add462a538b495f" dependencies = [ "cfg-if", "tracing-attributes", @@ -3902,10 +3899,11 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fbad39da2f9af1cae3016339ad7f2c7a9e870f12e8fd04c4fd7ef35b30c0d2b" +checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c" dependencies = [ + "proc-macro2", "quote", "syn", ] @@ -4013,9 +4011,9 @@ checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "uint" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e75a4cdd7b87b28840dba13c483b9a88ee6bbf16ba5c951ee1ecfcf723078e0d" +checksum = "173cd16430c206dc1a430af8a89a0e9c076cf15cb42b4aedb10e8cc8fee73681" dependencies = [ "byteorder", "crunchy", @@ -4070,9 +4068,9 @@ checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" [[package]] name = "untrusted" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60369ef7a31de49bcb3f6ca728d4ba7300d9a1658f94c727d4cab8c8d9f4aece" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" @@ -4096,9 +4094,9 @@ dependencies = [ [[package]] name = "validator" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab5990ba09102e1ddc954d294f09b9ea00fc7831a5813bbe84bfdbcae44051e" +checksum = "e60fadf92c22236de4028ceb0b8af50ed3430d41ad43d7a7d63b6bd1a8f47c38" dependencies = [ "idna", "lazy_static", @@ -4111,9 +4109,9 @@ dependencies = [ [[package]] name = "validator_derive" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e668e9cd05c5009b833833aa1147e5727b5396ea401f22dd1167618eed4a10c9" +checksum = "0d577dfb8ca9440a5c0b053d5a19b68f5c92ef57064bac87c8205c3f6072c20f" dependencies = [ "if_chain", "lazy_static", @@ -4126,21 +4124,21 @@ dependencies = [ [[package]] name = "vcpkg" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" +checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" [[package]] name = "vec_map" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" [[package]] name = "void" @@ -4189,9 +4187,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" -version = "0.2.60" +version = "0.2.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc57ce05287f8376e998cbddfb4c8cb43b84a7ec55cf4551d7c00eef317a47f" +checksum = "4c2dc4aa152834bc334f506c1a06b866416a8b6697d5c9f75b9a689c8486def0" dependencies = [ "cfg-if", "serde", @@ -4201,9 +4199,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.60" +version = "0.2.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d967d37bf6c16cca2973ca3af071d0a2523392e4a594548155d89a678f4237cd" +checksum = "ded84f06e0ed21499f6184df0e0cb3494727b0c5da89534e0fcc55c51d812101" dependencies = [ "bumpalo", "lazy_static", @@ -4216,9 +4214,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.10" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7add542ea1ac7fdaa9dc25e031a6af33b7d63376292bd24140c637d00d1c312a" +checksum = "64487204d863f109eb77e8462189d111f27cb5712cc9fdb3461297a76963a2f6" dependencies = [ "cfg-if", "js-sys", @@ -4228,9 +4226,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.60" +version = "0.2.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bd151b63e1ea881bb742cd20e1d6127cef28399558f3b5d415289bc41eee3a4" +checksum = "838e423688dac18d73e31edce74ddfac468e37b1506ad163ffaf0a46f703ffe3" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4238,9 +4236,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.60" +version = "0.2.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d68a5b36eef1be7868f668632863292e37739656a80fc4b9acec7b0bd35a4931" +checksum = "3156052d8ec77142051a533cdd686cba889537b213f948cd1d20869926e68e92" dependencies = [ "proc-macro2", "quote", @@ -4251,9 +4249,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.60" +version = "0.2.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf76fe7d25ac79748a37538b7daeed1c7a6867c92d3245c12c6222e4a20d639" +checksum = "c9ba19973a58daf4db6f352eda73dc0e289493cd29fb2632eb172085b6521acd" [[package]] name = "wasmer-runtime" @@ -4325,9 +4323,9 @@ checksum = "aeb1956b19469d1c5e63e459d29e7b5aa0f558d9f16fcef09736f8a265e6c10a" [[package]] name = "web-sys" -version = "0.3.37" +version = "0.3.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d6f51648d8c56c366144378a33290049eafdd784071077f6fe37dae64c1c4cb" +checksum = "7b72fe77fd39e4bd3eaa4412fd299a0be6b3dfe9d2597e2f1c20beb968f41d17" dependencies = [ "js-sys", "wasm-bindgen", @@ -4335,9 +4333,9 @@ dependencies = [ [[package]] name = "webpki" -version = "0.21.2" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f50e1972865d6b1adb54167d1c8ed48606004c2c9d0ea5f1eeb34d95e863ef" +checksum = "ab146130f5f790d45f82aeeb09e55a256573373ec64409fc19a6fb82fb1032ae" dependencies = [ "ring", "untrusted", @@ -4345,9 +4343,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cd5736df7f12a964a5067a12c62fa38e1bd8080aff1f80bc29be7c80d19ab4" +checksum = "f8eff4b7516a57307f9349c64bf34caa34b940b66fed4b2fb3136cb7386e5739" dependencies = [ "webpki", ] @@ -4363,9 +4361,9 @@ dependencies = [ [[package]] name = "widestring" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "effc0e4ff8085673ea7b9b2e3c73f6bd4d118810c9009ed8f1e16bd96c331db6" +checksum = "a763e303c0e0f23b0da40888724762e802a8ffefbc22de4127ef42493c2ea68c" [[package]] name = "winapi" @@ -4419,6 +4417,15 @@ dependencies = [ "winapi 0.3.8", ] +[[package]] +name = "winreg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +dependencies = [ + "winapi 0.3.8", +] + [[package]] name = "ws2_32-sys" version = "0.2.1" diff --git a/chain/client/src/client_actor.rs b/chain/client/src/client_actor.rs index b051bd4a3bb..b14c7d99322 100644 --- a/chain/client/src/client_actor.rs +++ b/chain/client/src/client_actor.rs @@ -515,11 +515,16 @@ impl Handler for ClientActor { is_slashed, }) .collect(); + let protocol_version = self .client .runtime_adapter .get_epoch_protocol_version(&head.epoch_id) .map_err(|err| err.to_string())?; + + let validator_account_id = + self.client.validator_signer.as_ref().map(|vs| vs.validator_id()).cloned(); + Ok(StatusResponse { version: self.client.config.version.clone(), protocol_version, @@ -534,6 +539,7 @@ impl Handler for ClientActor { latest_block_time: from_timestamp(latest_block_time), syncing: self.client.sync_status.is_syncing(), }, + validator_account_id, }) } } diff --git a/chain/client/src/info.rs b/chain/client/src/info.rs index c6e6cd06bd2..946fd31f0d3 100644 --- a/chain/client/src/info.rs +++ b/chain/client/src/info.rs @@ -8,6 +8,7 @@ use log::info; use sysinfo::{get_current_pid, set_open_files_limit, Pid, ProcessExt, System, SystemExt}; use near_chain_configs::ClientConfig; +use near_metrics::set_gauge; use near_network::types::NetworkInfo; use near_primitives::block::Tip; use near_primitives::network::PeerId; @@ -20,6 +21,7 @@ use near_primitives::validator_signer::ValidatorSigner; use near_primitives::version::Version; use near_telemetry::{telemetry, TelemetryActor}; +use crate::metrics; use crate::types::ShardSyncStatus; use crate::SyncStatus; @@ -111,6 +113,13 @@ impl InfoHelper { Blue.bold().paint(format!("CPU: {:.0}%, Mem: {}", cpu_usage, pretty_bytes(memory_usage * 1024))) ); + set_gauge(&metrics::IS_VALIDATOR, is_validator as i64); + set_gauge(&metrics::RECEIVED_BYTES_PER_SECOND, network_info.received_bytes_per_sec as i64); + set_gauge(&metrics::SENT_BYTES_PER_SECOND, network_info.sent_bytes_per_sec as i64); + set_gauge(&metrics::BLOCKS_PER_MINUTE, (avg_bls * (60 as f64)) as i64); + set_gauge(&metrics::CPU_USAGE, cpu_usage as i64); + set_gauge(&metrics::MEMORY_USAGE, memory_usage as i64); + self.started = Instant::now(); self.num_blocks_processed = 0; self.gas_used = 0; diff --git a/chain/client/src/metrics.rs b/chain/client/src/metrics.rs index ac3bd78dab3..74ab2c141f4 100644 --- a/chain/client/src/metrics.rs +++ b/chain/client/src/metrics.rs @@ -1,8 +1,24 @@ -use near_metrics::{try_create_int_counter, IntCounter}; +use near_metrics::{try_create_int_counter, try_create_int_gauge, IntCounter, IntGauge}; lazy_static! { pub static ref BLOCK_PRODUCED_TOTAL: near_metrics::Result = try_create_int_counter( "block_produced_total", "Total number of blocks produced since starting this node" ); + pub static ref IS_VALIDATOR: near_metrics::Result = + try_create_int_gauge("is_validator", "Bool to denote if it is currently validating"); + pub static ref RECEIVED_BYTES_PER_SECOND: near_metrics::Result = try_create_int_gauge( + "received_bytes_per_second", + "Number of bytes per second received over the network overall" + ); + pub static ref SENT_BYTES_PER_SECOND: near_metrics::Result = try_create_int_gauge( + "sent_bytes_per_second", + "Number of bytes per second sent over the network overall" + ); + pub static ref BLOCKS_PER_MINUTE: near_metrics::Result = + try_create_int_gauge("blocks_per_minute", "Blocks produced per minute"); + pub static ref CPU_USAGE: near_metrics::Result = + try_create_int_gauge("cpu_usage", "Percent of CPU usage"); + pub static ref MEMORY_USAGE: near_metrics::Result = + try_create_int_gauge("memory_usage", "Amount of RAM memory usage"); } diff --git a/chain/network/Cargo.toml b/chain/network/Cargo.toml index c9084823490..cdee4112354 100644 --- a/chain/network/Cargo.toml +++ b/chain/network/Cargo.toml @@ -18,6 +18,7 @@ rand = "0.7" byteorder = "1.2" lazy_static = "1.4" tracing = "0.1.13" +strum = { version = "0.18", features = ["derive"] } borsh = "0.6.2" cached = "0.12" diff --git a/chain/network/src/metrics.rs b/chain/network/src/metrics.rs index d08daa6a83e..1bbe03fc40b 100644 --- a/chain/network/src/metrics.rs +++ b/chain/network/src/metrics.rs @@ -1,19 +1,10 @@ -use near_metrics::{try_create_int_counter, try_create_int_gauge, IntCounter, IntGauge}; - -macro_rules! type_messages { - ($name_counter:ident, $name_bytes:ident) => { - lazy_static! { - pub static ref $name_counter: near_metrics::Result = try_create_int_counter( - stringify!($name_counter), - concat!("Peer Message ", stringify!($name_counter)), - ); - pub static ref $name_bytes: near_metrics::Result = try_create_int_counter( - stringify!($name_bytes), - concat!("Peer Message ", stringify!($name_bytes)), - ); - } - }; -} +use crate::types::{PeerMessage, RoutedMessageBody}; +use near_metrics::{ + inc_counter_by_opt, inc_counter_opt, try_create_histogram, try_create_int_counter, + try_create_int_gauge, Histogram, IntCounter, IntGauge, +}; +use std::collections::HashMap; +use strum::VariantNames; lazy_static! { pub static ref PEER_CONNECTIONS_TOTAL: near_metrics::Result = @@ -47,11 +38,14 @@ lazy_static! { "routing_table_recalculations", "Number of times routing table have been recalculated from scratch" ); - pub static ref ROUTING_TABLE_RECALCULATION_MILLISECONDS: near_metrics::Result = - try_create_int_gauge( - "routing_table_recalculation_milliseconds", + + + pub static ref ROUTING_TABLE_RECALCULATION_HISTOGRAM: near_metrics::Result = + try_create_histogram( + "routing_table_recalculation_histogram", "Time spent recalculating routing table" ); + pub static ref EDGE_UPDATES: near_metrics::Result = try_create_int_counter( "edge_updates", @@ -90,51 +84,64 @@ lazy_static! { pub static ref RECEIVED_INFO_ABOUT_ITSELF: near_metrics::Result = try_create_int_counter("received_info_about_itself", "Number of times a peer tried to connect to itself"); } -type_messages!(HANDSHAKE_RECEIVED_TOTAL, HANDSHAKE_RECEIVED_BYTES); -type_messages!(HANDSHAKE_FAILURE_RECEIVED_TOTAL, HANDSHAKE_FAILURE_RECEIVED_BYTES); -type_messages!(SYNC_RECEIVED_TOTAL, SYNC_RECEIVED_BYTES); -type_messages!(REQUEST_UPDATE_NONCE_RECEIVED_TOTAL, REQUEST_UPDATE_NONCE_RECEIVED_BYTES); -type_messages!(RESPONSE_UPDATE_NONCE_RECEIVED_TOTAL, RESPONSE_UPDATE_NONCE_RECEIVED_BYTES); -type_messages!(LAST_EDGE_RECEIVED_TOTAL, LAST_EDGE_RECEIVED_BYTES); -type_messages!(PEERS_REQUEST_RECEIVED_TOTAL, PEERS_REQUEST_RECEIVED_BYTES); -type_messages!(PEERS_RESPONSE_RECEIVED_TOTAL, PEERS_RESPONSE_RECEIVED_BYTES); -type_messages!(BLOCK_HEADERS_REQUEST_RECEIVED_TOTAL, BLOCK_HEADERS_REQUEST_RECEIVED_BYTES); -type_messages!(BLOCK_HEADERS_RECEIVED_TOTAL, BLOCK_HEADERS_RECEIVED_BYTES); -type_messages!(BLOCK_HEADER_ANNOUNCE_RECEIVED_TOTAL, BLOCK_HEADER_ANNOUNCE_RECEIVED_BYTES); -type_messages!(BLOCK_REQUEST_RECEIVED_TOTAL, BLOCK_REQUEST_RECEIVED_BYTES); -type_messages!(BLOCK_RECEIVED_TOTAL, BLOCK_RECEIVED_BYTES); -type_messages!(TRANSACTION_RECEIVED_TOTAL, TRANSACTION_RECEIVED_BYTES); -type_messages!(ROUTED_STATE_REQUEST_RECEIVED_TOTAL, ROUTED_STATE_REQUEST_RECEIVED_BYTES); -type_messages!(ROUTED_STATE_RESPONSE_RECEIVED_TOTAL, ROUTED_STATE_RESPONSE_RECEIVED_BYTES); -type_messages!(ROUTED_BLOCK_APPROVAL_RECEIVED_TOTAL, ROUTED_BLOCK_APPROVAL_RECEIVED_BYTES); -type_messages!(ROUTED_FORWARD_TX_RECEIVED_TOTAL, ROUTED_FORWARD_TX_RECEIVED_BYTES); -type_messages!(ROUTED_TX_STATUS_REQUEST_RECEIVED_TOTAL, ROUTED_TX_STATUS_REQUEST_RECEIVED_BYTES); -type_messages!(ROUTED_TX_STATUS_RESPONSE_RECEIVED_TOTAL, ROUTED_TX_STATUS_RESPONSE_RECEIVED_BYTES); -type_messages!(ROUTED_QUERY_REQUEST_RECEIVED_TOTAL, ROUTED_QUERY_REQUEST_RECEIVED_BYTES); -type_messages!(ROUTED_QUERY_RESPONSE_RECEIVED_TOTAL, ROUTED_QUERY_RESPONSE_RECEIVED_BYTES); -type_messages!( - ROUTED_RECEIPT_OUTCOME_REQUEST_RECEIVED_TOTAL, - ROUTED_RECEIPT_OUTCOME_REQUEST_RECEIVED_BYTES -); -type_messages!( - ROUTED_RECEIPT_OUTCOME_RESPONSE_RECEIVED_TOTAL, - ROUTED_RECEIPT_OUTCOME_RESPONSE_RECEIVED_BYTES -); -type_messages!( - ROUTED_STATE_REQUEST_HEADER_RECEIVED_TOTAL, - ROUTED_STATE_REQUEST_HEADER_RECEIVED_BYTES -); -type_messages!(ROUTED_STATE_REQUEST_PART_RECEIVED_TOTAL, ROUTED_STATE_REQUEST_PART_RECEIVED_BYTES); -type_messages!( - ROUTED_PARTIAL_CHUNK_REQUEST_RECEIVED_TOTAL, - ROUTED_PARTIAL_CHUNK_REQUEST_RECEIVED_BYTES -); -type_messages!( - ROUTED_PARTIAL_CHUNK_RESPONSE_RECEIVED_TOTAL, - ROUTED_PARTIAL_CHUNK_RESPONSE_RECEIVED_BYTES -); -type_messages!(ROUTED_PARTIAL_CHUNK_RECEIVED_TOTAL, ROUTED_PARTIAL_CHUNK_RECEIVED_BYTES); -type_messages!(ROUTED_PING_RECEIVED_TOTAL, ROUTED_PING_RECEIVED_BYTES); -type_messages!(ROUTED_PONG_RECEIVED_TOTAL, ROUTED_PONG_RECEIVED_BYTES); -type_messages!(DISCONNECT_RECEIVED_TOTAL, DISCONNECT_RECEIVED_BYTES); -type_messages!(CHALLENGE_RECEIVED_TOTAL, CHALLENGE_RECEIVED_BYTES); +#[derive(Clone)] +pub struct NetworkMetrics { + pub peer_messages: HashMap>, +} + +impl NetworkMetrics { + pub fn new() -> Self { + let mut peer_messages = HashMap::new(); + + let variants = PeerMessage::VARIANTS + .into_iter() + .filter(|&name| *name != "Routed") + .chain(RoutedMessageBody::VARIANTS.into_iter()); + + for name in variants { + let counter_name = NetworkMetrics::peer_message_total_rx(name.as_ref()); + peer_messages.insert( + counter_name.clone(), + try_create_int_counter(counter_name.as_ref(), counter_name.as_ref()).ok(), + ); + + let counter_name = NetworkMetrics::peer_message_bytes_rx(name.as_ref()); + peer_messages.insert( + counter_name.clone(), + try_create_int_counter(counter_name.as_ref(), counter_name.as_ref()).ok(), + ); + + let counter_name = NetworkMetrics::peer_message_dropped(name.as_ref()); + peer_messages.insert( + counter_name.clone(), + try_create_int_counter(counter_name.as_ref(), counter_name.as_ref()).ok(), + ); + } + + Self { peer_messages } + } + + pub fn peer_message_total_rx(message_name: &str) -> String { + format!("{}_total", message_name) + } + + pub fn peer_message_bytes_rx(message_name: &str) -> String { + format!("{}_bytes", message_name) + } + + pub fn peer_message_dropped(message_name: &str) -> String { + format!("{}_dropped", message_name) + } + + pub fn inc(&self, message_name: &str) { + if let Some(counter) = self.peer_messages.get(message_name) { + inc_counter_opt(counter.as_ref()); + } + } + + pub fn inc_by(&self, message_name: &str, value: i64) { + if let Some(counter) = self.peer_messages.get(message_name) { + inc_counter_by_opt(counter.as_ref(), value); + } + } +} diff --git a/chain/network/src/peer.rs b/chain/network/src/peer.rs index 2a0ec394ad1..c98aaa057da 100644 --- a/chain/network/src/peer.rs +++ b/chain/network/src/peer.rs @@ -33,6 +33,7 @@ use crate::types::{ }; use crate::PeerManagerActor; use crate::{metrics, NetworkResponses}; +use metrics::NetworkMetrics; type WriteHalf = tokio::io::WriteHalf; @@ -156,6 +157,8 @@ pub struct Peer { edge_info: Option, /// Last time an update of received message was sent to PeerManager last_time_received_message_update: Instant, + /// Dynamic Prometheus metrics + network_metrics: NetworkMetrics, } impl Peer { @@ -170,6 +173,7 @@ impl Peer { client_addr: Recipient, view_client_addr: Recipient, edge_info: Option, + network_metrics: NetworkMetrics, ) -> Self { Peer { node_info, @@ -187,6 +191,7 @@ impl Peer { chain_info: Default::default(), edge_info, last_time_received_message_update: Instant::now(), + network_metrics, } } @@ -609,7 +614,13 @@ impl StreamHandler> for Peer { self.peer_manager_addr.do_send(metadata); } - peer_msg.record(msg.len()); + self.network_metrics + .inc(NetworkMetrics::peer_message_total_rx(&peer_msg.msg_variant()).as_ref()); + + self.network_metrics.inc_by( + NetworkMetrics::peer_message_bytes_rx(&peer_msg.msg_variant()).as_ref(), + msg.len() as i64, + ); match (self.peer_type, self.peer_status, peer_msg) { (_, PeerStatus::Connecting, PeerMessage::HandshakeFailure(peer_info, reason)) => { diff --git a/chain/network/src/peer_manager.rs b/chain/network/src/peer_manager.rs index d706e136338..38bf035f02b 100644 --- a/chain/network/src/peer_manager.rs +++ b/chain/network/src/peer_manager.rs @@ -44,6 +44,7 @@ use crate::types::{ KnownPeerState, NetworkClientMessages, NetworkConfig, NetworkRequests, NetworkResponses, PeerInfo, }; +use metrics::NetworkMetrics; /// How often to request peers from active peers. const REQUEST_PEERS_SECS: u64 = 60; @@ -105,6 +106,8 @@ pub struct PeerManagerActor { monitor_peers_attempts: u64, /// Active peers we have sent new edge update, but we haven't received response so far. pending_update_nonce_request: HashMap, + /// Dynamic Prometheus metrics + network_metrics: NetworkMetrics, /// Store all collected metrics from a node. #[cfg(feature = "metric_recorder")] metric_recorder: MetricRecorder, @@ -138,6 +141,7 @@ impl PeerManagerActor { routing_table, monitor_peers_attempts: 0, pending_update_nonce_request: HashMap::new(), + network_metrics: NetworkMetrics::new(), #[cfg(feature = "metric_recorder")] metric_recorder, }) @@ -350,6 +354,8 @@ impl PeerManagerActor { } }; + let network_metrics = self.network_metrics.clone(); + // Start every peer actor on separate thread. let arbiter = Arbiter::new(); Peer::start_in_arbiter(&arbiter, move |ctx| { @@ -368,6 +374,7 @@ impl PeerManagerActor { .map(Result::unwrap), ctx, ); + Peer::new( PeerInfo { id: peer_id, addr: Some(server_addr), account_id }, remote_addr, @@ -379,6 +386,7 @@ impl PeerManagerActor { client_addr, view_client_addr, edge_info, + network_metrics, ) }); } @@ -820,7 +828,11 @@ impl PeerManagerActor { } Err(find_route_error) => { // TODO(MarX, #1369): Message is dropped here. Define policy for this case. - near_metrics::inc_counter(&metrics::DROP_MESSAGE_UNREACHABLE_PEER); + self.network_metrics.inc( + NetworkMetrics::peer_message_dropped(strum::AsStaticRef::as_static(&msg.body)) + .as_str(), + ); + debug!(target: "network", "{:?} Drop signed message to {:?} Reason {:?}. Known peers: {:?} Message {:?}", self.config.account_id, msg.target, diff --git a/chain/network/src/routing.rs b/chain/network/src/routing.rs index 2d405f838b0..e0d091b7d2e 100644 --- a/chain/network/src/routing.rs +++ b/chain/network/src/routing.rs @@ -664,11 +664,12 @@ impl RoutingTable { /// Recalculate routing table. pub fn update(&mut self) { + let _routing_table_recalculation = + near_metrics::start_timer(&metrics::ROUTING_TABLE_RECALCULATION_HISTOGRAM); + trace!(target: "network", "Update routing table."); self.recalculation_scheduled = None; - let start = Instant::now(); - self.peer_forwarding = self.raw_graph.calculate_distance(); let now = chrono::Utc::now(); @@ -678,13 +679,7 @@ impl RoutingTable { self.try_save_edges(); - let duration = Instant::now().duration_since(start).as_millis(); - near_metrics::inc_counter_by(&metrics::ROUTING_TABLE_RECALCULATIONS, 1); - near_metrics::set_gauge( - &metrics::ROUTING_TABLE_RECALCULATION_MILLISECONDS, - duration as i64, - ); near_metrics::set_gauge(&metrics::PEER_REACHABLE, self.peer_forwarding.len() as i64); } diff --git a/chain/network/src/types.rs b/chain/network/src/types.rs index 1c1cb928a21..b435067c6b1 100644 --- a/chain/network/src/types.rs +++ b/chain/network/src/types.rs @@ -18,7 +18,6 @@ use tracing::{error, warn}; use near_chain::types::ShardStateSyncResponse; use near_chain::{Block, BlockHeader}; use near_crypto::{PublicKey, SecretKey, Signature}; -use near_metrics; use near_primitives::block::{Approval, ApprovalMessage, GenesisId}; use near_primitives::challenge::Challenge; use near_primitives::errors::InvalidTxError; @@ -33,7 +32,6 @@ use near_primitives::utils::{from_timestamp, to_timestamp}; use near_primitives::version::FIRST_BACKWARD_COMPATIBLE_PROTOCOL_VERSION; use near_primitives::views::{FinalExecutionOutcomeView, QueryRequest, QueryResponse}; -use crate::metrics; use crate::peer::Peer; #[cfg(feature = "metric_recorder")] use crate::recorder::MetricRecorder; @@ -216,7 +214,17 @@ pub struct Pong { } // TODO(#1313): Use Box -#[derive(BorshSerialize, BorshDeserialize, Serialize, PartialEq, Eq, Clone, Debug)] +#[derive( + BorshSerialize, + BorshDeserialize, + Serialize, + PartialEq, + Eq, + Clone, + Debug, + strum::AsStaticStr, + strum::EnumVariantNames, +)] #[allow(clippy::large_enum_variant)] pub enum RoutedMessageBody { BlockApproval(Approval), @@ -395,7 +403,17 @@ impl SyncData { /// Warning, position of each message type in this enum defines the protocol due to serialization. /// DO NOT MOVE, REORDER, DELETE items from the list. Only add new items to the end. /// If need to remove old items - replace with `None`. -#[derive(BorshSerialize, BorshDeserialize, Serialize, PartialEq, Eq, Clone, Debug)] +#[derive( + BorshSerialize, + BorshDeserialize, + Serialize, + PartialEq, + Eq, + Clone, + Debug, + strum::AsStaticStr, + strum::EnumVariantNames, +)] // TODO(#1313): Use Box #[allow(clippy::large_enum_variant)] pub enum PeerMessage { @@ -428,245 +446,17 @@ pub enum PeerMessage { impl fmt::Display for PeerMessage { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - PeerMessage::Handshake(_) => f.write_str("Handshake"), - PeerMessage::HandshakeFailure(_, _) => f.write_str("HandshakeFailure"), - PeerMessage::Sync(_) => f.write_str("Sync"), - PeerMessage::RequestUpdateNonce(_) => f.write_str("RequestUpdateNonce"), - PeerMessage::ResponseUpdateNonce(_) => f.write_str("ResponseUpdateNonce"), - PeerMessage::LastEdge(_) => f.write_str("LastEdge"), - PeerMessage::PeersRequest => f.write_str("PeersRequest"), - PeerMessage::PeersResponse(_) => f.write_str("PeersResponse"), - PeerMessage::BlockHeadersRequest(_) => f.write_str("BlockHeaderRequest"), - PeerMessage::BlockHeaders(_) => f.write_str("BlockHeaders"), - PeerMessage::BlockRequest(_) => f.write_str("BlockRequest"), - PeerMessage::Block(_) => f.write_str("Block"), - PeerMessage::Transaction(_) => f.write_str("Transaction"), - PeerMessage::Routed(routed_message) => match routed_message.body { - RoutedMessageBody::BlockApproval(_) => f.write_str("BlockApproval"), - RoutedMessageBody::ForwardTx(_) => f.write_str("ForwardTx"), - RoutedMessageBody::TxStatusRequest(_, _) => f.write_str("Transaction status query"), - RoutedMessageBody::TxStatusResponse(_) => { - f.write_str("Transaction status response") - } - RoutedMessageBody::QueryRequest { .. } => f.write_str("Query request"), - RoutedMessageBody::QueryResponse { .. } => f.write_str("Query response"), - RoutedMessageBody::StateRequestHeader(_, _) => f.write_str("StateRequestHeader"), - RoutedMessageBody::StateRequestPart(_, _, _) => f.write_str("StateRequestPart"), - RoutedMessageBody::StateResponse(_) => f.write_str("StateResponse"), - RoutedMessageBody::ReceiptOutcomeRequest(_) => { - f.write_str("Receipt outcome request") - } - RoutedMessageBody::ReceiptOutComeResponse(_) => { - f.write_str("Receipt outcome response") - } - RoutedMessageBody::PartialEncodedChunkRequest(_) => { - f.write_str("PartialEncodedChunkRequest") - } - RoutedMessageBody::PartialEncodedChunkResponse(_) => { - f.write_str("PartialEncodedChunkResponse") - } - RoutedMessageBody::PartialEncodedChunk(_) => f.write_str("PartialEncodedChunk"), - RoutedMessageBody::Ping(_) => f.write_str("Ping"), - RoutedMessageBody::Pong(_) => f.write_str("Pong"), - }, - PeerMessage::Disconnect => f.write_str("Disconnect"), - PeerMessage::Challenge(_) => f.write_str("Challenge"), - } + f.write_str(format!("{}", self.msg_variant()).as_ref()) } } impl PeerMessage { - pub fn record(&self, size: usize) { + pub fn msg_variant(&self) -> &str { match self { - PeerMessage::Handshake(_) => { - near_metrics::inc_counter(&metrics::HANDSHAKE_RECEIVED_TOTAL); - near_metrics::inc_counter_by(&metrics::HANDSHAKE_RECEIVED_BYTES, size as i64); - } - PeerMessage::HandshakeFailure(_, _) => { - near_metrics::inc_counter(&metrics::HANDSHAKE_FAILURE_RECEIVED_TOTAL); - near_metrics::inc_counter_by( - &metrics::HANDSHAKE_FAILURE_RECEIVED_BYTES, - size as i64, - ); - } - PeerMessage::Sync(_) => { - near_metrics::inc_counter(&metrics::SYNC_RECEIVED_TOTAL); - near_metrics::inc_counter_by(&metrics::SYNC_RECEIVED_BYTES, size as i64); - } - PeerMessage::RequestUpdateNonce(_) => { - near_metrics::inc_counter(&metrics::REQUEST_UPDATE_NONCE_RECEIVED_TOTAL); - near_metrics::inc_counter_by( - &metrics::REQUEST_UPDATE_NONCE_RECEIVED_BYTES, - size as i64, - ); - } - PeerMessage::ResponseUpdateNonce(_) => { - near_metrics::inc_counter(&metrics::RESPONSE_UPDATE_NONCE_RECEIVED_TOTAL); - near_metrics::inc_counter_by( - &metrics::RESPONSE_UPDATE_NONCE_RECEIVED_BYTES, - size as i64, - ); - } - PeerMessage::LastEdge(_) => { - near_metrics::inc_counter(&metrics::LAST_EDGE_RECEIVED_TOTAL); - near_metrics::inc_counter_by(&metrics::LAST_EDGE_RECEIVED_BYTES, size as i64); - } - PeerMessage::PeersRequest => { - near_metrics::inc_counter(&metrics::PEERS_REQUEST_RECEIVED_TOTAL); - near_metrics::inc_counter_by(&metrics::PEERS_REQUEST_RECEIVED_BYTES, size as i64); - } - PeerMessage::PeersResponse(_) => { - near_metrics::inc_counter(&metrics::PEERS_RESPONSE_RECEIVED_TOTAL); - near_metrics::inc_counter_by(&metrics::PEERS_RESPONSE_RECEIVED_BYTES, size as i64); - } - PeerMessage::BlockHeadersRequest(_) => { - near_metrics::inc_counter(&metrics::BLOCK_HEADERS_REQUEST_RECEIVED_TOTAL); - near_metrics::inc_counter_by( - &metrics::BLOCK_HEADERS_REQUEST_RECEIVED_BYTES, - size as i64, - ); - } - PeerMessage::BlockHeaders(_) => { - near_metrics::inc_counter(&metrics::BLOCK_HEADERS_RECEIVED_TOTAL); - near_metrics::inc_counter_by(&metrics::BLOCK_HEADERS_RECEIVED_BYTES, size as i64); - } - PeerMessage::BlockRequest(_) => { - near_metrics::inc_counter(&metrics::BLOCK_REQUEST_RECEIVED_TOTAL); - near_metrics::inc_counter_by(&metrics::BLOCK_REQUEST_RECEIVED_BYTES, size as i64); - } - PeerMessage::Block(_) => { - near_metrics::inc_counter(&metrics::BLOCK_RECEIVED_TOTAL); - near_metrics::inc_counter_by(&metrics::BLOCK_RECEIVED_BYTES, size as i64); - } - PeerMessage::Transaction(_) => { - near_metrics::inc_counter(&metrics::TRANSACTION_RECEIVED_TOTAL); - near_metrics::inc_counter_by(&metrics::TRANSACTION_RECEIVED_BYTES, size as i64); - } - PeerMessage::Routed(routed_message) => match routed_message.body { - RoutedMessageBody::BlockApproval(_) => { - near_metrics::inc_counter(&metrics::ROUTED_BLOCK_APPROVAL_RECEIVED_TOTAL); - near_metrics::inc_counter_by( - &metrics::ROUTED_BLOCK_APPROVAL_RECEIVED_BYTES, - size as i64, - ); - } - RoutedMessageBody::ForwardTx(_) => { - near_metrics::inc_counter(&metrics::ROUTED_FORWARD_TX_RECEIVED_TOTAL); - near_metrics::inc_counter_by( - &metrics::ROUTED_FORWARD_TX_RECEIVED_BYTES, - size as i64, - ); - } - RoutedMessageBody::TxStatusRequest(_, _) => { - near_metrics::inc_counter(&metrics::ROUTED_TX_STATUS_REQUEST_RECEIVED_TOTAL); - near_metrics::inc_counter_by( - &metrics::ROUTED_TX_STATUS_REQUEST_RECEIVED_BYTES, - size as i64, - ); - } - RoutedMessageBody::TxStatusResponse(_) => { - near_metrics::inc_counter(&metrics::ROUTED_TX_STATUS_RESPONSE_RECEIVED_TOTAL); - near_metrics::inc_counter_by( - &metrics::ROUTED_TX_STATUS_RESPONSE_RECEIVED_BYTES, - size as i64, - ); - } - RoutedMessageBody::QueryRequest { .. } => { - near_metrics::inc_counter(&metrics::ROUTED_QUERY_REQUEST_RECEIVED_TOTAL); - near_metrics::inc_counter_by( - &metrics::ROUTED_QUERY_REQUEST_RECEIVED_BYTES, - size as i64, - ); - } - RoutedMessageBody::QueryResponse { .. } => { - near_metrics::inc_counter(&metrics::ROUTED_QUERY_RESPONSE_RECEIVED_TOTAL); - near_metrics::inc_counter_by( - &metrics::ROUTED_QUERY_RESPONSE_RECEIVED_BYTES, - size as i64, - ); - } - RoutedMessageBody::ReceiptOutcomeRequest(_) => { - near_metrics::inc_counter( - &metrics::ROUTED_RECEIPT_OUTCOME_REQUEST_RECEIVED_TOTAL, - ); - near_metrics::inc_counter_by( - &metrics::ROUTED_RECEIPT_OUTCOME_REQUEST_RECEIVED_BYTES, - size as i64, - ); - } - RoutedMessageBody::ReceiptOutComeResponse(_) => { - near_metrics::inc_counter( - &metrics::ROUTED_RECEIPT_OUTCOME_RESPONSE_RECEIVED_TOTAL, - ); - near_metrics::inc_counter_by( - &metrics::ROUTED_RECEIPT_OUTCOME_RESPONSE_RECEIVED_BYTES, - size as i64, - ); - } - RoutedMessageBody::StateRequestHeader(_, _) => { - near_metrics::inc_counter(&metrics::ROUTED_STATE_REQUEST_HEADER_RECEIVED_TOTAL); - near_metrics::inc_counter_by( - &metrics::ROUTED_STATE_REQUEST_HEADER_RECEIVED_BYTES, - size as i64, - ); - } - RoutedMessageBody::StateRequestPart(_, _, _) => { - near_metrics::inc_counter(&metrics::ROUTED_STATE_REQUEST_PART_RECEIVED_TOTAL); - near_metrics::inc_counter_by( - &metrics::ROUTED_STATE_REQUEST_PART_RECEIVED_BYTES, - size as i64, - ); - } - RoutedMessageBody::StateResponse(_) => { - near_metrics::inc_counter(&metrics::ROUTED_STATE_RESPONSE_RECEIVED_TOTAL); - near_metrics::inc_counter_by( - &metrics::ROUTED_STATE_RESPONSE_RECEIVED_BYTES, - size as i64, - ); - } - RoutedMessageBody::PartialEncodedChunkRequest(_) => { - near_metrics::inc_counter( - &metrics::ROUTED_PARTIAL_CHUNK_REQUEST_RECEIVED_TOTAL, - ); - near_metrics::inc_counter_by( - &metrics::ROUTED_PARTIAL_CHUNK_REQUEST_RECEIVED_BYTES, - size as i64, - ); - } - RoutedMessageBody::PartialEncodedChunkResponse(_) => { - near_metrics::inc_counter( - &metrics::ROUTED_PARTIAL_CHUNK_RESPONSE_RECEIVED_TOTAL, - ); - near_metrics::inc_counter_by( - &metrics::ROUTED_PARTIAL_CHUNK_RESPONSE_RECEIVED_BYTES, - size as i64, - ); - } - RoutedMessageBody::PartialEncodedChunk(_) => { - near_metrics::inc_counter(&metrics::ROUTED_PARTIAL_CHUNK_RECEIVED_TOTAL); - near_metrics::inc_counter_by( - &metrics::ROUTED_PARTIAL_CHUNK_RECEIVED_BYTES, - size as i64, - ); - } - RoutedMessageBody::Ping(_) => { - near_metrics::inc_counter(&metrics::ROUTED_PING_RECEIVED_TOTAL); - near_metrics::inc_counter_by(&metrics::ROUTED_PING_RECEIVED_BYTES, size as i64); - } - RoutedMessageBody::Pong(_) => { - near_metrics::inc_counter(&metrics::ROUTED_PONG_RECEIVED_TOTAL); - near_metrics::inc_counter_by(&metrics::ROUTED_PONG_RECEIVED_BYTES, size as i64); - } - }, - PeerMessage::Disconnect => { - near_metrics::inc_counter(&metrics::DISCONNECT_RECEIVED_TOTAL); - near_metrics::inc_counter_by(&metrics::DISCONNECT_RECEIVED_BYTES, size as i64); - } - PeerMessage::Challenge(_) => { - near_metrics::inc_counter(&metrics::CHALLENGE_RECEIVED_TOTAL); - near_metrics::inc_counter_by(&metrics::CHALLENGE_RECEIVED_BYTES, size as i64); + PeerMessage::Routed(routed_message) => { + strum::AsStaticRef::as_static(&routed_message.body) } + _ => strum::AsStaticRef::as_static(self), } } diff --git a/core/metrics/src/lib.rs b/core/metrics/src/lib.rs index e8ba261e848..e0e0eb6dcdc 100644 --- a/core/metrics/src/lib.rs +++ b/core/metrics/src/lib.rs @@ -126,6 +126,12 @@ pub fn inc_counter(counter: &Result) { } } +pub fn inc_counter_opt(counter: Option<&IntCounter>) { + if let Some(counter) = counter { + counter.inc(); + } +} + pub fn get_counter(counter: &Result) -> std::result::Result { if let Ok(counter) = counter { Ok(counter.get()) @@ -142,6 +148,12 @@ pub fn inc_counter_by(counter: &Result, value: i64) { } } +pub fn inc_counter_by_opt(counter: Option<&IntCounter>, value: i64) { + if let Some(counter) = counter { + counter.inc_by(value); + } +} + pub fn set_gauge(gauge: &Result, value: i64) { if let Ok(gauge) = gauge { gauge.set(value); diff --git a/core/primitives/src/views.rs b/core/primitives/src/views.rs index f0c3f6666ca..037534b78b8 100644 --- a/core/primitives/src/views.rs +++ b/core/primitives/src/views.rs @@ -266,6 +266,8 @@ pub struct StatusResponse { pub validators: Vec, /// Sync status of the node. pub sync_info: StatusSyncInfo, + /// Validator id of the node + pub validator_account_id: Option, } impl TryFrom for AccountView {